Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I trying a use the vlookup function to look up a couple set of formulas used
to calculate the cost of my list of items. How Can I get the vlookup to read the formula and not the value of the formula? If it helps here is one of the formulas if it helps =IF(AQ28,AQ2/4-1,IF(AQ2=1,-2,IF(AQ2=2, 1,IF(AQ2=4,0,IF(AQ2=8,1,"Invalid")))))+$A$4 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
John,
Here's a UDF that will return the formula in a cell. Put this in a regular module: Function GetFormula(MyCell As Range) As String GetFormula = MyCell.Formula End Function Call it in your cell with =GetFormula(A1) I don't think you can wrap it around your VLOOKUP as VLOOKUP returns a value, not a reference. But you could wrap it around a MATCH wrapped around an INDEX, which functions like VLOOKUP: =GetFormula(INDEX(F1:F5,MATCH(B4,E1:E5,0))) Here the table is E1:F5, and it's looking down the E column for what's in B4. It will return the formula in F1:F5. -- Earl Kiosterud www.smokeylake.com Note: Top-posting has been the norm here. Some folks prefer bottom-posting. But if you bottom-post to a reply that's already top-posted, the thread gets messy. When in Rome... ----------------------------------------------------------------------- "john" wrote in message ... I trying a use the vlookup function to look up a couple set of formulas used to calculate the cost of my list of items. How Can I get the vlookup to read the formula and not the value of the formula? If it helps here is one of the formulas if it helps =IF(AQ28,AQ2/4-1,IF(AQ2=1,-2,IF(AQ2=2, 1,IF(AQ2=4,0,IF(AQ2=8,1,"Invalid")))))+$A$4 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
In , Earl Kiosterud
spake thusly: Here's a UDF that will return the formula in a cell. Put this in a regular module: Function GetFormula(MyCell As Range) As String GetFormula = MyCell.Formula End Function Call it in your cell with =GetFormula(A1) Very helpful, Earl! (Where were you when I asked a vaguely similar question last month?) :-) I will have use for your UDF. =dman= ================== I don't think you can wrap it around your VLOOKUP as VLOOKUP returns a value, not a reference. But you could wrap it around a MATCH wrapped around an INDEX, which functions like VLOOKUP: =GetFormula(INDEX(F1:F5,MATCH(B4,E1:E5,0))) Here the table is E1:F5, and it's looking down the E column for what's in B4. It will return the formula in F1:F5. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with Lookup(), VLookup | Excel Worksheet Functions | |||
LOOKUP or VLOOKUP | Excel Worksheet Functions | |||
Formula using IF? Vlookup? Lookup? I'm not sure. | Excel Worksheet Functions | |||
Lookup without VLOOKUP? | New Users to Excel | |||
LOOKUP or VLOOKUP | Excel Worksheet Functions |