Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default if and vlookup functions

I need to do a function that will look for one of three criterion in a cell,
if condition a,b, or c is met, then I need to lookup a person's name and then
assign them to a team. So far I've tried the following formulae, but it turns
up NA or TRUE.

=if(f96="teamA"),vlookup(a96,TeamA!$a$4:$f$100,3,f alse),
if(f96="teamB"),vlookup(a96,TeamB!$a$4:$f$100,3,fa lse),
if(f96="teamC"),vlookup(a96,TeamC!$a$4:$f$100,3,fa lse)

Please advise as I'm quite new to this. Regards.

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 8,856
Default if and vlookup functions

The general form for IF is:

=IF(condition, action_if_true, action_if_false)

and you can nest these together (up to 7 times) as you have done.
However, you still need one open and one closed bracket for each IF,
and you should try to cover all eventualities (i.e. what do you want if
F96 doesn't contain any of TeamA, TeamB or TeamC ? Try this:

=if(f96="teamA"),vlookup(a96,TeamA!$a$4:$f$100,3,f alse),
if(f96="teamB"),vlookup(a96,TeamB!$a$4:$f$100,3,fa lse),
if(f96="teamC"),vlookup(a96,TeamC!$a$4:$f$100,3,fa lse),"none")))

If A96 is not present in the table in the TeamA sheet when F96 = TeamA,
then the VLOOKUP formula will return an error #N/A - you can trap this
using a construction along the lines of:

=IF(ISNA(your_vlookup_formula),"not present",your_vlookup_formula)

but you can see that this will complicate your formula even more, as
you will have this for each of TeamA, TeamB and Team C.

Finally, as your VLOOKUP formulae are very similar, you could think
about replacing them with one formula using INDIRECT in the middle to
pick up the team name (and therefore sheet name) from F96.

Hope this helps.

Pete



GD Raynor wrote:
I need to do a function that will look for one of three criterion in a cell,
if condition a,b, or c is met, then I need to lookup a person's name and then
assign them to a team. So far I've tried the following formulae, but it turns
up NA or TRUE.

=if(f96="teamA"),vlookup(a96,TeamA!$a$4:$f$100,3,f alse),
if(f96="teamB"),vlookup(a96,TeamB!$a$4:$f$100,3,fa lse),
if(f96="teamC"),vlookup(a96,TeamC!$a$4:$f$100,3,fa lse)

Please advise as I'm quite new to this. Regards.


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,718
Default if and vlookup functions

=IF(OR(F96={"teamA","teamB","teamC"}),VLOOKUP(F96, A4:F100,3,0))


"GD Raynor" wrote:

I need to do a function that will look for one of three criterion in a cell,
if condition a,b, or c is met, then I need to lookup a person's name and then
assign them to a team. So far I've tried the following formulae, but it turns
up NA or TRUE.

=if(f96="teamA"),vlookup(a96,TeamA!$a$4:$f$100,3,f alse),
if(f96="teamB"),vlookup(a96,TeamB!$a$4:$f$100,3,fa lse),
if(f96="teamC"),vlookup(a96,TeamC!$a$4:$f$100,3,fa lse)

Please advise as I'm quite new to this. Regards.

  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,886
Default if and vlookup functions

Hi

I think I would be inclined to create 3 named ranges.
InsertNameDefineNameTeamA Refers to TeamA!$A$4:$F$100
Repeat for TeaamB and TeamC

Then your formula simplifies to
=VLOOKUP(A96,INDIRECT(F96),3,0)

--
Regards

Roger Govier


"GD Raynor" <GD wrote in message
...
I need to do a function that will look for one of three criterion in a
cell,
if condition a,b, or c is met, then I need to lookup a person's name
and then
assign them to a team. So far I've tried the following formulae, but
it turns
up NA or TRUE.

=if(f96="teamA"),vlookup(a96,TeamA!$a$4:$f$100,3,f alse),
if(f96="teamB"),vlookup(a96,TeamB!$a$4:$f$100,3,fa lse),
if(f96="teamC"),vlookup(a96,TeamC!$a$4:$f$100,3,fa lse)

Please advise as I'm quite new to this. Regards.





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
Using VLOOKUP, IF and RIGHT functions together Alicia Excel Worksheet Functions 3 September 29th 06 04:31 PM
Combining VLOOKUP functions Jay Excel Worksheet Functions 16 August 31st 06 06:52 PM
VLOOKUP and logical functions Margherita Excel Worksheet Functions 5 August 21st 06 03:47 PM
if statements depending on multiple VLOOKUP functions njuneardave Excel Discussion (Misc queries) 1 June 21st 06 04:33 PM
Embedding functions in Vlookup? AsstInterests Excel Worksheet Functions 2 May 25th 06 08:54 PM


All times are GMT +1. The time now is 11:51 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"