Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel, How Can you Show what Formula is in another Cell? 2

Status
Not open for further replies.

Randy11

Technical User
Oct 4, 2002
175
CA
Want to set up a cell next to a cell with a formula in it & have the formula show in the second cell. Needs to be set up that if the original formula is changed so would the 2nd cell. See below.

Cell B1 Formula Result Sample of Result Wanted in Cell B2
1 =SUM(Sheet2!E16:E19)
This is the formula in B1
 
AFAIK the only way to do this is with a User Defined Function (UDF).

Put this in a code module:
[blue]
Code:
Option Explicit

Function ShowFormula(Ref As Range) As String
  ShowFormula = Ref.Formula
End Function
[/color]

Then put this in the worksheet:
[blue]
Code:
B1: =SUM(Sheet2!E16:E19)
B2: =ShowFormula(B1)
[/color]


 
Excellent Solution, Worked like a charm, Thanks! [sunshine]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top