+ Reply to Thread
Results 1 to 12 of 12

Need help with vlookup that has multiple if statements

  1. #1
    Registered User
    Join Date
    04-24-2014
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    20

    Need help with vlookup that has multiple if statements

    I need to lookup an equipment number on a table and based on certain criteria bring back a value.

    The formula I've tried looks like this:

    =VLOOKUP(A2,Table!A:G,IF(VLOOKUP('Data to be populated'!A2,Table!A:G)="FLOAT VOLTAGE",3,IF('Data to be populated'!A2,Table!A:G)="UNINTENTIONAL GROUNDS",5,IF(VLOOKUP('Data to be populated'!A2,Table!A:G)="WATER LEVEL OK",5)," "))

    I'm getting the error "You've entered too few arguments for this function".

    I've attached a spreadsheet.
    Data that I need populated (tab1) based on the table (tab 2)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Need help with vlookup that has multiple if statements

    In Excel, there's a type of formula called array formula that lets you to do a lookup based on multiple lookup values. In C2, enter
    =INDEX(Table!$C$2:$C$100,MATCH(A2&B2,Table!$A$2:$A$100&Table!$B$2:$B$100,0)) and enter the formula with Ctrl + Shift + Enter keys together.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need help with vlookup that has multiple if statements

    A non-array (ordinary) formula to do the same. However, I suspect the problem is more compolicated. can the equipment be tested in more than one date?? Then what happens??

    In C2, copied down:
    =IFERROR(INDEX(Table!C$2:C$100,MATCH(1,INDEX((Table!$A$2:$A$100=$A2)*(Table!$B$2:$B$100=$B2),0),0)),"")

    similar formuale in D2 & E2.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    04-24-2014
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need help with vlookup that has multiple if statements

    This worked great for bringing in the Measurement Reading! Thank you!

    I'm still having problems with Measurement Date and Read by. I changed the formula to:

    Measurement Date: {=INDEX(Table!$F$2:$F$100,MATCH(B2&C2,Table!$A$2:$A$100&Table!$B$2:$B$100,0))}
    Read by: {=INDEX(Table!$G$2:$G$100,MATCH(B2&C2,Table!$A$2:$A$100&Table!$B$2:$B$100,0))}

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need help with vlookup that has multiple if statements

    If your dataset is large... the array formula (especially using range concatenation) can be very slow.

  6. #6
    Registered User
    Join Date
    04-24-2014
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need help with vlookup that has multiple if statements

    I think vlookup might work better. Simply because, based on an IF statement you will bring back from different columns. Can someone help me with a vlookup and if statements?

    =VLOOKUP(A2,Table!A:G,IF(VLOOKUP('Data to be populated'!A2,Table!A:G)="FLOAT VOLTAGE",3,IF('Data to be populated'!A2,Table!A:G)="UNINTENTIONAL GROUNDS",5,IF(VLOOKUP('Data to be populated'!A2,Table!A:G)="WATER LEVEL OK",5)," "))

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need help with vlookup that has multiple if statements

    In what way did thr solution offered at Post 3 NOT work?

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Need help with vlookup that has multiple if statements

    There don't appear to be any matches in your sample file, however I think this is what you want:

    =IFNA(LOOKUP(VLOOKUP(A2,Table!$A$1:$B$100,2,0),{"FLOAT VOLTAGE","UNINTENTIONAL GROUNDS","WATER LEVEL OK"},{3,5,5}),"")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Registered User
    Join Date
    04-24-2014
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need help with vlookup that has multiple if statements

    I'm getting a #NAME? ERROR using this method

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need help with vlookup that has multiple if statements

    Who are you talking to?

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Need help with vlookup that has multiple if statements

    If you are talking to me, IFNA is relatively new.

    You could try this instead:

    =IFERROR(LOOKUP(VLOOKUP(A2,Table!$A$1:$B$100,2,0),{"FLOAT VOLTAGE","UNINTENTIONAL GROUNDS","WATER LEVEL OK"},{3,5,5}),"")

  12. #12
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Need help with vlookup that has multiple if statements

    If you use the same column headings in both tables then (CSE):
    Please Login or Register  to view this content.
    drag across and down...
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vlookup with multiple IF statements
    By andrea5676 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-19-2016, 04:23 PM
  2. Multiple IF statements with VLOOKUP
    By Barry L in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 11-11-2015, 09:21 PM
  3. [SOLVED] Problems connecting multiple If and VLOOKUP statements
    By thomas.lyons in forum Excel General
    Replies: 11
    Last Post: 12-30-2014, 02:02 PM
  4. Replies: 3
    Last Post: 07-25-2013, 08:25 AM
  5. Replies: 7
    Last Post: 11-13-2012, 11:46 AM
  6. Using vlookup and if/then statements for multiple tables
    By HP RodNuclear in forum Excel General
    Replies: 9
    Last Post: 04-06-2011, 05:15 PM
  7. [SOLVED] if statements depending on multiple VLOOKUP functions
    By njuneardave in forum Excel General
    Replies: 1
    Last Post: 06-21-2006, 11:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1