Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Using IF statement in a VLOOKUP

I created a VLOOKUP that includes an IF statement. However, I need to be able
to reference 4 possible scenarios not only 2. Currently
,(IF($J$1=1,6,(IF($J$1=2,7)))) works. I need it to also ask IF($J$1=3,8) and
IF($J$1=4,9) in some sort of formula.

I have provided my formula below.

=VLOOKUP($A7,$A$4:$I$3000,(IF($J$1=1,6,(IF($J$1=2, 7)))),FALSE).

Any help will be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Using IF statement in a VLOOKUP

You seem to be adding 5 onto J1 as long as J1 is 1 to 4. So, you could
reduce the number of IFs like this:

=VLOOKUP($A7,$A$4:$I$3000,IF(AND($J$1=1,$J$1<=4), 5+$J$1,1),FALSE)

The IF returns 1 if J1 is not valid, which in turn will return the
lookup value ($A7). There is no error checking here to see if A7 does
exist in A4:A3000 (which it obviously does !!).

Hope this helps.

Pete

On Feb 16, 4:01*pm, wormburner
wrote:
I created a VLOOKUP that includes an IF statement. However, I need to be able
to reference 4 possible scenarios not only 2. Currently
,(IF($J$1=1,6,(IF($J$1=2,7)))) works. I need it to also ask IF($J$1=3,8) and
IF($J$1=4,9) in some sort of formula.

I have provided my formula below.

=VLOOKUP($A7,$A$4:$I$3000,(IF($J$1=1,6,(IF($J$1=2, 7)))),FALSE).

Any help will be appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Using IF statement in a VLOOKUP

Wormburner -

If the lookup always returns a number 5 greater, try this:

=VLOOKUP($A7,$A$4:$I$3000,($J$1+5),FALSE)

Otherwise, if $J$1 is always a small integer, you can use a CHOOSE function,
like this:

=VLOOKUP($A7,$A$4:$I$3000,CHOOSE($J$1,6,7,8,9),FAL SE)

--
Daryl S


"wormburner" wrote:

I created a VLOOKUP that includes an IF statement. However, I need to be able
to reference 4 possible scenarios not only 2. Currently
,(IF($J$1=1,6,(IF($J$1=2,7)))) works. I need it to also ask IF($J$1=3,8) and
IF($J$1=4,9) in some sort of formula.

I have provided my formula below.

=VLOOKUP($A7,$A$4:$I$3000,(IF($J$1=1,6,(IF($J$1=2, 7)))),FALSE).

Any help will be appreciated.

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
vlookup with if statement? KC Excel Discussion (Misc queries) 0 February 2nd 10 06:38 PM
Not sure whether to use VLOOKUP or an IF statement Allison1962 Excel Worksheet Functions 2 February 2nd 09 09:21 PM
using vlookup within an if statement Sweetetc Excel Worksheet Functions 7 December 6th 06 05:54 PM
If statement with Vlookup Marty Excel Worksheet Functions 1 March 30th 06 04:15 PM
VLOOKUP with IF statement Kay Excel Discussion (Misc queries) 4 August 18th 05 02:51 AM


All times are GMT +1. The time now is 08:49 PM.

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

About Us

"It's about Microsoft Excel"