IF statement that returns a formula

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
What cell is your formula in? It should be in B1 (Or anything from E1 onwards)

Also, what are the values in A1, C1 and D1?
 
Upvote 0
I just figured out what the problem was but this relates to a bigger question in general. Here is my example. I am working on a VLOOKUP formula and am wondering how I can have the return value of the VLOOKUP formula to be a formula. Is that possible? So instead of returning a value, I want the VLOOKUP to return "C$4 + D$4". I want to do this so I can copy this VLOOKUP formula throughout my spreadsheet. (I would use an if statement but there are 23 conditions)
 
Upvote 0
There is probably a better way to do it but the way I would do it would be with a helper column, I would make E$4 = C$4 + D$4 and make your VLookup return E$4
 
Upvote 0
I just figured out what the problem was but this relates to a bigger question in general. Here is my example. I am working on a VLOOKUP formula and am wondering how I can have the return value of the VLOOKUP formula to be a formula. Is that possible? So instead of returning a value, I want the VLOOKUP to return "C$4 + D$4". I want to do this so I can copy this VLOOKUP formula throughout my spreadsheet. (I would use an if statement but there are 23 conditions)

You can have cell references as entries in cells and refer to them indirectly, if that is what you're after. But you can't refer to formulae indirectly as far as I know.

So if C$4 was written in A1, INDIRECT(A1) would return the value in C$4.

But if C$4+D$4 was written in A1, INDIRECT(A1) would give an error.
 
Upvote 0
The C$4 + D$4 was a simpler formula than what I have. Here is what I have. Column A has Account numbers (23 of them) and Column B:Z has monthly figures. For each account, I want to calculate figures in column AA with a different formula for each account and this account sequence repeats in various order over 600 time underneath the first set of complete accounts. I hope this makes sense.

Account
4000
5000
6000
7000
 
Upvote 0
The C$4 + D$4 was a simpler formula than what I have. Here is what I have. Column A has Account numbers (23 of them) and Column B:Z has monthly figures. For each account, I want to calculate figures in column AA with a different formula for each account and this account sequence repeats in various order over 600 time underneath the first set of complete accounts. I hope this makes sense.

Account
4000
5000
6000
7000

=EVAL(VLOOKUP(LookupValue,FormulaTable,2,0))

where FormulaTable houses in its 2nd column values like:

'=C$4+D$4

On the other hand, Excel is not an appropriate environment for this kind of processing set up as a programming language like Lisp would.

EVAL requires the free morefunc.xll add-in.
 
Upvote 0
I have installed the morefunc.xll and the formula worked like a charm. I can finally get some sleep. I offer you the most sincere gratitude. Also, I find this site to be very helpful and have referred to it on many occassions. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top