Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default return a formula instead of a value of a cell

Is it possible to let excel return a formula instead of the cells value. At
this stage I need to write all possible formula's for each cell (vlookup will
return the corret one depending on a code inserted by user). I was wondering
if it was possible to return a formula instead of a value. This would make my
lookup table considirable smaler and avoids repeating all formulas 60 times.
And I only have to edit one formula/cell to correct mistakes.

Example:
Cell B3 on Sheet2 contains the following

O&row/P&row * Q&row

I want excel to actually return this formala to the cell on sheet1 and not
the result.

thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default return a formula instead of a value of a cell

You could use a UDF (User Defined Function) that returns a string--but it's not
a formula anymore.



willemeulen wrote:

Is it possible to let excel return a formula instead of the cells value. At
this stage I need to write all possible formula's for each cell (vlookup will
return the corret one depending on a code inserted by user). I was wondering
if it was possible to return a formula instead of a value. This would make my
lookup table considirable smaler and avoids repeating all formulas 60 times.
And I only have to edit one formula/cell to correct mistakes.

Example:
Cell B3 on Sheet2 contains the following

O&row/P&row * Q&row

I want excel to actually return this formala to the cell on sheet1 and not
the result.

thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default return a formula instead of a value of a cell

Here is a User Defined FUnction to return the formula:

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


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function:

=formulaa(Sheet1!A1)

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx




--
Gary''s Student - gsnu200853


"willemeulen" wrote:

Is it possible to let excel return a formula instead of the cells value. At
this stage I need to write all possible formula's for each cell (vlookup will
return the corret one depending on a code inserted by user). I was wondering
if it was possible to return a formula instead of a value. This would make my
lookup table considirable smaler and avoids repeating all formulas 60 times.
And I only have to edit one formula/cell to correct mistakes.

Example:
Cell B3 on Sheet2 contains the following

O&row/P&row * Q&row

I want excel to actually return this formala to the cell on sheet1 and not
the result.

thanks

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
Return formula in cell [email protected] Excel Worksheet Functions 2 February 6th 08 04:13 PM
Formula to return cell position AJPendragon Excel Worksheet Functions 1 February 6th 06 09:34 PM
function CELL() to return the formula in the referenced cell Streep Excel Worksheet Functions 3 August 20th 05 10:24 PM
formula to return certain cell jerry Excel Discussion (Misc queries) 1 June 23rd 05 11:28 PM
Formula to return the name of a cell Adresmith Excel Discussion (Misc queries) 2 June 14th 05 07:31 PM


All times are GMT +1. The time now is 12:21 AM.

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"