display formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do i display a formula or function in the cell next to the one containing
the result.
For example the function =date(2008,1,31) in cell A1 gives me 1/31/2008 in
cell A1. Now in cell A2 I want to show the function displayed as
=date(2008,1,31) instead of the result so that one can see the function next
to the result.

I would be grateful if someone can offer me some help about doing this.

Thanks so much.
 
One way:

Select the formula cell A1

In the formula bar add an apostrophe to the beginning of the formula so that
it looks like this:

'=date(2008,1,31)

Then hit enter.

Now, just copy A1 to A2 then remove the apostrophe from cell A1.

Biff
 
You could employ a User Defined Function in the adjacent cell.

Function ShowFormula(cell)
ShowFormula = "No Formula"
If cell.HasFormula Then ShowFormula = cell.Formula
End Function

=ShowFormula(cellref)

First off.........save a backup of your workbook.

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the code in there.

Save the workbook and hit ALT + Q to return to Excel window.

Enter the formula in a helper cell as explained above.


Gord Dibben MS Excel MVP
 
Back
Top