Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Albert
 
Posts: n/a
Default Reading formulae in a different cell

If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
reference or find the 3rd argument in the formula from another cell. When I
use any formula that references A1 it always uses the result of the formula
(99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).

Thanks
--

Albert
  #2   Report Post  
Posted to microsoft.public.excel.misc
Niek Otten
 
Posts: n/a
Default Reading formulae in a different cell

Hi Albert,

You can use this User Defined Function (UDF):

Function ShowFormula(a As Range)
If Application.ReferenceStyle = xlR1C1 _
Then ShowFormula = a.FormulaR1C1 _
Else: ShowFormula = a.Formula
End Function


--
Kind regards,

Niek Otten

"Albert" wrote in message ...
| If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
| reference or find the 3rd argument in the formula from another cell. When I
| use any formula that references A1 it always uses the result of the formula
| (99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).
|
| Thanks
| --
|
| Albert


  #3   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Reading formulae in a different cell

You could use a UDF to display the formula as a string and then parse the
string with MID(), LEFT(), etc.:

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



and use like =textofformula(A1)
--
Gary's Student


"Albert" wrote:

If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
reference or find the 3rd argument in the formula from another cell. When I
use any formula that references A1 it always uses the result of the formula
(99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).

Thanks
--

Albert

  #4   Report Post  
Posted to microsoft.public.excel.misc
Albert
 
Posts: n/a
Default Reading formulae in a different cell

Many thanks for your help.
--
Albert


"Niek Otten" wrote:

Hi Albert,

You can use this User Defined Function (UDF):

Function ShowFormula(a As Range)
If Application.ReferenceStyle = xlR1C1 _
Then ShowFormula = a.FormulaR1C1 _
Else: ShowFormula = a.Formula
End Function


--
Kind regards,

Niek Otten

"Albert" wrote in message ...
| If cell A1 contains a formula e.g. =Vlookup(50,RANGE,2)=99.45 say, how can I
| reference or find the 3rd argument in the formula from another cell. When I
| use any formula that references A1 it always uses the result of the formula
| (99.45 here) and not the text of the formula ( =vlookup(50.RANGE,2) ).
|
| Thanks
| --
|
| Albert



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 02:36 AM
Reading Cell Function??? roy.okinawa Excel Worksheet Functions 2 December 2nd 05 12:29 AM
Cell color based upon cell value My View Excel Discussion (Misc queries) 11 July 6th 05 04:59 AM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 08:11 AM
how can i test whether cell contains keyed constant or a formulae Ruthki Excel Worksheet Functions 6 June 22nd 05 01:44 PM


All times are GMT +1. The time now is 11:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"