+ Reply to Thread
Results 1 to 10 of 10

additional criteria in vlookup/if formula. formula error

  1. #1
    Registered User
    Join Date
    06-27-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    5

    additional criteria in vlookup/if formula. formula error

    This is the formula I'm using now and it works fine with no errors.....
    =IF(D12=704,VLOOKUP(B12,Table1[#All],7),VLOOKUP(D12,'Pivot by Account'!$A$4:$D$10,4))



    But I need to add an additional criteria.... if cell D12 is 704 and B12 on the original Table1 lookup is blank, I need look up a value in cell A12 and the output needs to be from a column in the table

    =IF(D12=704,VLOOKUP(B12,Table1[#All],7),if(B12"",vlookup(a12,Table1[#All],7)),VLOOKUP(D12,'Pivot by Account'!$A$4:$D$10,4))

    I am getting an error on this part ...B5""
    forgive me if I didn't post my question correctly, this is my first post.
    Attached Files Attached Files
    Last edited by tmw6; 06-27-2015 at 03:50 AM.

  2. #2
    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,023

    Re: additional criteria in vlookup/if formula. formula error

    I can't visualise this without a sheet in front of me (can't work with jpgs...); but try (untested)

    =IF(AND(D12=704, B12=""),VLOOKUP(B12,Table1[#All],7),VLOOKUP(D12,'Pivot by Account'!$A$4:$D$10,4))
    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

  3. #3
    Registered User
    Join Date
    06-27-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    5

    Re: additional criteria in vlookup/if formula. formula error

    samples.xls
    here it is
    I had to switch browsers in order to be able to upload the file

  4. #4
    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,023

    Re: additional criteria in vlookup/if formula. formula error

    OK. Try this:

    =IF(AND(D2=704, B2=""),VLOOKUP(A2,Table1[#All],7),VLOOKUP(D2,'Pivot by Account'!$A$4:$D$10,4))

    in G2, copied down.

  5. #5
    Registered User
    Join Date
    06-27-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    5

    Re: additional criteria in vlookup/if formula. formula error

    ahhh ok so IF/AND is what I should have been doing.
    thank you so much
    I'm pulling out my excel study books to get acquainted with this function now so that I'll know what to do next time

  6. #6
    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,023

    Re: additional criteria in vlookup/if formula. formula error

    You're welcome... and thanks!

  7. #7
    Registered User
    Join Date
    06-27-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    5

    Re: additional criteria in vlookup/if formula. formula error

    wait, I was so happy that it returned any value and didnt give me an error message that I didn't realize that I didn't get the value I need.
    G5 should be travel & accommodations now, but using the if(and function it's giving me "Budget Line Item" which is the right column but it doesn't correspond with the right row

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: additional criteria in vlookup/if formula. formula error

    =IF(AND(D2=704, B2=""),VLOOKUP(A2,Table1[#All],7,0),VLOOKUP(D2,'Pivot by Account'!$A$4:$D$10,4,0))
    little modification to glen formula
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  9. #9
    Registered User
    Join Date
    06-27-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    5

    Re: additional criteria in vlookup/if formula. formula error

    the modification worked! thank you
    now I have to go study the impact of adding ,0 at the end
    wonderful learning experience

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: additional criteria in vlookup/if formula. formula error

    0 means you want to find an "exact" match of the lookup value. You can also use FALSE as the argument:

    VLOOKUP(A2,Table1[#All],7,0)
    VLOOKUP(A2,Table1[#All],7,FALSE)

    Both do the same thing but I prefer using 0 as it's less typing!

    Using 1 or TRUE or omitting the argument means you want an approximate match of the lookup value:

    VLOOKUP(A2,Table1[#All],7,1)
    VLOOKUP(A2,Table1[#All],7,TRUE)
    VLOOKUP(A2,Table1[#All],7)

    This syntax is usually for looking up number values that fall within a range where there might not be an exact match. A good example of this is converting number grades to letter grades. For example:

    Data Range
    A
    B
    1
    Number Grade
    Letter Grade
    2
    0
    F
    3
    75
    D
    4
    85
    C
    5
    95
    B
    6
    100
    A


    If we want to find the corresponding letter grade for the number 87 we would use:

    =VLOOKUP(87,A2:B6,2)

    Result = C

    There is no exact match of the lookup value so the function uses the closest (approximate) match that is less than the lookup value.

    Note: in order to work properly this syntax requires the lookup table be sorted in ascending order on the leftmost column.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. [SOLVED] need to add additional criteria to existing formula
    By Mattr177 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-31-2014, 12:12 AM
  2. [SOLVED] additional criteria for if formula
    By 2001jesper in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-14-2013, 04:25 PM
  3. [SOLVED] Want to add additional criteria to a working formula
    By mrp in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-13-2012, 06:36 PM
  4. Additional criteria for 'sumproduct' formula
    By dallston in forum Excel General
    Replies: 7
    Last Post: 01-28-2009, 02:18 PM

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