Trouble Nesting a formulae

stewyb

New Member
Joined
Jul 15, 2011
Messages
16
Hi Guys,

Wondering if you can help me...

I'll try my best to explain it.

I am trying to write:

If one number (1) equals another number (1) then do a vlookup. I can do that fine and if it doesn't equal the number it returns False, so I know that is right.

What I want to do is carry it on so "If one number (1) equals another number (1) then do a vlookup, if it doesn't equal that number, but equals the next number (2) then do a vlookup"

I hope that is enough info, If not let me know and I'll try and explain better
 

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.
At the end of the first IF statement, after "IF(A1=1,Vlookup, " (in the FALSE area), add:

Code:
If A1 = 2,Vlookup.......,FALSE

I don't know the particulars, so I have to speak generally, but that might lead you in the right direction.
 
Upvote 0
How many iterations will there be?
Which version of Excel do you have?

Can you post the 2 different VLOOKUPS that would be used based on the value of the given number?
Please post ACTUAL formulas and possible values of the number. Not Psudo simplified code.
 
Last edited:
Upvote 0
Thanks Guys, that was quick. I can get it to work but the IF statement only lets me use 2 iterations, is there a function that will let me use more?

Using excel 2007

The formula I am using is "=IF(D46=D2,(VLOOKUP(A48,$A$4:$I$40,4,0)),IF(D46=E2,(VLOOKUP(A48,$A$4:$I$40,5,0))))"

Thanks loads
 
Upvote 0
Try this assuming your iterations will be consistent..

D46 = D2 then 4
D46 = E2 then 5
D46 = F2 then 6
D46 = G2 then 7
Etc..

=VLOOKUP(A48,$A$4:$I$40,MATCH(D46,$D$2:$I$2,0)+3,0)
 
Upvote 0
=VLOOKUP(A48,$A$4:$I$40,MATCH(D46,$D$2:$I$2,0)+3,0)

Here, the MATCH portion searches for D46 within D2:I2
it returns the position # where it was found.
If it's found in D2 - match returns 1
If it's found in E2 - match returns 2
etc..

But your formula was needing 4 if it's in D2 and 5 if it's in E2 etc..
So I added 3.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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