Any function which return the formula of a cell?

gaftalik

Well-known Member
Hi,

Is there any function which can return the formula of a cell ?

Thank you.

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

earlyd

Well-known Member
What do you mean by the formula of a cell - do you mean the cell reference? If so there is the ADDRESS function. If you mean a function that can contain a cell value and give you the value of that cell, then you want the INDIRECT function.

But I really don't know what you mean.

al_b_cnu

Well-known Member
Hi,

You could try this simple UDF:

Code:
``````Function xxx(ByVal xyz As Range) As Variant
xxx = xyz.Formula
End Function``````

HTH

Alan

gaftalik

Well-known Member
Hi Alan,

Thanks for the code , it worked perfect but if i have this in a formula :
=1+3+5

How to return 1 or 3 or 5
is it left(xxx(text or other ?

Thank you very much .

MrExcel MVP
gaftalik said:
... but if i have this in a formula :
=1+3+5

How to return 1 or 3 or 5
is it left(xxx(text or other ?...

Entered in B1 and copied across:

=WMID(SUBSTITUTE(FORMULATEXT(\$A1),"=","",1),COLUMN()-COLUMN(\$B\$1)+1,1,"+")

where A1 houses =1+2+3.

The formula requires the morefunc add-in.

PS. Why do you need this manipulation?

gaftalik

Well-known Member
Thank you Champ ! you amaze me as always .

needed that not to reintroduce data separately from a copied sheet.

No sea will carry my ships of thanks to you Aladdin!

Thanks everybody .

pgc01

MrExcel MVP
HI Phil

You don't really need the Offset():

=GET.CELL(6,INDIRECT("R[-1]C",FALSE))

Replies
6
Views
177
Replies
12
Views
211
Replies
3
Views
76
Replies
13
Views
204
Replies
0
Views
261

1,186,363
Messages
5,957,418
Members
438,304
Latest member
duck90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back