+ Reply to Thread
Results 1 to 13 of 13

Need help with a VLOOKUP formule with two criteria...

  1. #1
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Need help with a VLOOKUP formule with two criteria...

    Hi everyone,

    i need some help with returning a value in a cell (or returning several values) based on not one but multiple criteria.

    For example, column B always has a two to three letter code that is basically one or two letters and zero or one symbol (only + or -), like 'CV-' or 'AD+' or 'R-'. Column E includes string that can include the two letter code 'FA', amongst other string values, or even nothing.

    Please Login or Register  to view this content.
    Now, what I'm looking for is, a formule that says to look up a certain string in column B, let's say for this example string 'D+', and another string value in column E, let's say 'fa', and then return the matching string value in column C or D or whatever column.

    I know how to write the formula to lookup 'D+' in column B and return the column C value (but then it returns the second row value from column C, not incorrect but the fifth row also matches), and I know how to write the code to lookup 'fa' in column E and return the column C value (but then it returns the third row value from column C, not incorrect but the fifth and sixth row also match), but I don't know how to write the formula to return the only string value (or the first of all string values) in column C for which both the column B value is 'D+' and the column E value contains 'fa'. Any help?

    Denis
    Last edited by HosteDenis; 03-12-2020 at 12:33 PM.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Need help with a VLOOKUP formule with two criteria...

    you can use an array formula
    =INDEX(C:C,MATCH(G5&H5,B:B&E:E,0))
    use control + shift+ enter for an array
    where G5 & H5 have the lookup criteria

    although I suspect you are after more than a simple lookup
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Re: Need help with a VLOOKUP formule with two criteria...

    That should do the trick. Now I'll try to implement it in my file. Thanks for the help, don't know why I didn't think of an array formula before as I've used plenty before!

  4. #4
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Re: Need help with a VLOOKUP formule with two criteria...

    Doesn't seem to work... Don't know what I do differently

    See following file

    My formula and question is on page one. All other data is deleted. The relevant data is in row 2555 to row 2809.
    Attached Files Attached Files

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Need help with a VLOOKUP formule with two criteria...

    not sure what you are trying to do - not clear from the spreadsheet or rows
    The relevant data is in row 2555 to row 2809.


    you will need to explain exactly what you are doing and examples of the data and result

    the formula will work - BUT as i say, not sure that was what you were after

  6. #6
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Re: Need help with a VLOOKUP formule with two criteria...

    Sorry, I thought it would be clear from page 1. there you can read the following:

    Schermafbeelding 2020-03-12 om 16.42.48.png

    so the values it wants to look up are, again, D+ and FA, which I placed in cells P11 and P12.

    It needs to look up value P11 in column B (or column B & C since these two column are merged for the relevant data, so the lookup reach is B2555:C2809) and it needs to lookup value P12 in column L (or column L to O, in L2555:O2809). Then it needs to return the string in column D (or column D and E since they're merged, so the return reach is D2555:E2809).

    My current formula is =INDEX(D2555:E2809;VERGELIJKEN(P11&P12;B2555:C2809&L2555:O2809;0)) which is what you also use (I think vergelijken is match in english excel).

    Hope this clears it up.

    Denis

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Need help with a VLOOKUP formule with two criteria...

    this may be the issue
    B2555:C2809&L2555:O2809
    should it be
    B2555:B2809&L2555:L2809

  8. #8
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Re: Need help with a VLOOKUP formule with two criteria...

    yeah I've tried it as you say before as well (also for D) but doesn't change anything, still doesn't work

  9. #9
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Need help with a VLOOKUP formule with two criteria...

    breaking it down
    you have merged columns, never good for formulas to work in

    P11 = D+
    P12 = FA

    =INDEX(D2555:D2809,MATCH(P11&P12,B2555:B2809&L2555:L2809,0))

    you want to return value in D+ that matches in column B and FA in column L

    which row has
    D+ in column B
    and FA in column L

  10. #10
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Re: Need help with a VLOOKUP formule with two criteria...

    Quote Originally Posted by etaf View Post
    you have merged columns, never good for formulas to work in
    I know, but unfortunately that is how this file is made up.

    Quote Originally Posted by etaf View Post
    P11 = D+
    P12 = FA

    you want to return value in D+ that matches in column B and FA in column L

    which row has
    D+ in column B
    and FA in column L
    Yes, that is exactly what I want. I want to return the string value in D in the same row that matches 'D+' in column B and 'FA' in column L.

    Denis

  11. #11
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Need help with a VLOOKUP formule with two criteria...

    can you post which row has just D+ in column B and JUST FA in column L
    I think this is where the string comments may have been and so its NOT just those values
    if it were , then the formula i posted would work

  12. #12
    Registered User
    Join Date
    04-26-2014
    Location
    Leuven, België
    MS-Off Ver
    Excel for Mac 2011
    Posts
    44

    Re: Need help with a VLOOKUP formule with two criteria...

    Quote Originally Posted by etaf View Post
    JUST FA in column L
    This made me realise how to make it work, thanks! I had to change cell P12 from FA to *FA*, because column L doesn't ONLY contain FA. Now it works! Thanks

  13. #13
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Need help with a VLOOKUP formule with two criteria...

    you are welcome

+ 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] Help on formule
    By dekueb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-28-2016, 07:52 AM
  2. [SOLVED] Vba sum formule
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2015, 10:21 AM
  3. [SOLVED] Vlookup vba code formule not working
    By brainzlp in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-16-2015, 02:41 PM
  4. Formule =ALS
    By mazaike in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-09-2015, 05:37 AM
  5. More than one value in MID formule
    By Teddymanne in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 08-08-2014, 12:13 PM
  6. Need a formule for this....
    By Jerin John in forum Excel General
    Replies: 1
    Last Post: 03-23-2011, 12:38 AM
  7. dynamic range (table_array) in vlookup formule
    By cuoredicapitano in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-11-2010, 11:09 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