ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Return formula as text (https://www.excelbanter.com/excel-worksheet-functions/153426-return-formula-text.html)

Paul Wittle

Return formula as text
 
Hi,

I have a load of cells which contain formula links to other tabs i.e.

='sometab'!A34

and of course they return the value of the cell. Further down I'm writing a
new formula and I don't want to re-write all the formulas, I would prefer to
return the tab as text a then create new references.

return the formula from above and cut it so it reads

'sometab'!

Then use indirect function to put the tab reference into the new forumlae.

Anyone know a walk around to return the formula NOT the value?
Cheers,
Paul.

Gary''s Student

Return formula as text
 
first enter this one-line UDF:

Function formuli(r As Range) As String
formuli = r.Formula
End Function

then if A1 contains:

=sometab!A34

=MID(formuli(A1),2,FIND("!",formuli(A1),1)-1)
will return:
sometab!

--
Gary''s Student - gsnu200736


"Paul Wittle" wrote:

Hi,

I have a load of cells which contain formula links to other tabs i.e.

='sometab'!A34

and of course they return the value of the cell. Further down I'm writing a
new formula and I don't want to re-write all the formulas, I would prefer to
return the tab as text a then create new references.

return the formula from above and cut it so it reads

'sometab'!

Then use indirect function to put the tab reference into the new forumlae.

Anyone know a walk around to return the formula NOT the value?
Cheers,
Paul.



All times are GMT +1. The time now is 03:56 AM.

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