Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sloth
 
Posts: n/a
Default Reference Cell Content

How would I reference the content of a cell instead of the result?

Example:
A1: =IF(1,2,0) (Result is 2 formatted as number)
A2: ???? (Result is "=IF(1,2,0)" formatted as text)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Reference Cell Content

Sloth wrote...
How would I reference the content of a cell instead of the result?

Example:
A1: =IF(1,2,0) (Result is 2 formatted as number)
A2: ???? (Result is "=IF(1,2,0)" formatted as text)


Excel provides no built-in support for this, so you need to use
programming or add-ins. The simplistic approach would be to use XLM
function calls in defined names. Given your example, move to cell A2,
define a name like f1up referring to

=GET.FORMULA(A1)

and enter the formula =f1up in cell A2. The BIG drawback to this is
that in older versions of Excel (2000 and prior), copying a cell with a
formula referring to defined names that call XLM functions and trying
to paste into other worksheets will CRASH Excel. The lesser drawback is
that this approach is inflexible.

The programming option involves writing a user-defined function in VBA.
Put the following code in a general VBA module.

Function ft(r As Range) As String
ft = r.Areas(1).Cells(1, 1).Formula
End Function

In your example, enter the formula =ft(A1) in cell A2.

The add-in approach involves downloading and installing Laurent
Longre's MOREFUNC.XLL add-in, available from
http://xcell05.free.fr/english/ . It provides a function names
FORMULATEXT that does what you want. Enter =FORMULATEXT(A1) in cell A2.

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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Nesting a sheet name reference within a cell reference??? Broyston Excel Discussion (Misc queries) 9 July 8th 08 08:35 PM
Cell reference problem Jim Olsen Excel Worksheet Functions 4 October 31st 05 05:47 AM
how do I format a cell reference to move as source changes KGray Excel Worksheet Functions 1 August 13th 05 12:41 AM
Flexible Cell Reference Brandt Excel Discussion (Misc queries) 5 June 2nd 05 10:23 PM


All times are GMT +1. The time now is 02:30 PM.

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

About Us

"It's about Microsoft Excel"