ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   formula to show a formula in a different cell (https://www.excelbanter.com/excel-worksheet-functions/107859-formula-show-formula-different-cell.html)

Todd

formula to show a formula in a different cell
 
How do I get a formula to show info from the formula used in a different cell?

A1 =sheet name!*f33

B1 =formula to tell me the sheet name used in A1's formula


Thanks,


Todd

Dave F

formula to show a formula in a different cell
 
Two options:
1) put an apostrophe to the left of the formula in A1, copy and paste the
entire text string int0 B1, or
2) Create a UDF with the following code:
Function GetFormula(Cell As Range) As String
GetFormula = Cell.Formula
If Cell.HasArray Then GetFormula = "{" & GetFormula & "}"
End Function

To create a UDF, right-click on the tab, select view code, and then in the
left hand pane navigate to your workbook. Inset a module, paste the above
code into the module, save, close out of the visual basic editor, go back to
B2 and enter =getformula(A1) and watch your formula appear.

Dave


--
Brevity is the soul of wit.


"Todd" wrote:

How do I get a formula to show info from the formula used in a different cell?

A1 =sheet name!*f33

B1 =formula to tell me the sheet name used in A1's formula


Thanks,


Todd



All times are GMT +1. The time now is 08:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com