+ Reply to Thread
Results 1 to 16 of 16

How to get VLookup to keep searching

  1. #1
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    How to get VLookup to keep searching

    Hi,

    I am currently trying to get VLookup to keep searching if the first match it finds has an empty cell.

    For example;

    Column A Column B Vlookup name Vlookup value
    Pizza place A Pizza place A 0
    Pizza place A 10
    Pizza place B 15

    How do I make an if statement or similar for the Vlookup to see the first match is 0, keep searching, add the value for the next match which in this case will be "10" for Pizza place A?

    Thanks

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

    Re: How to get VLookup to keep searching

    There are instructions at the top of the page explaining how to attach your sample workbook.
    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.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: How to get VLookup to keep searching

    short answer - you cant. Vlookup finds the 1st match, then stops looking.

    If you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like, we can see if there is another approach we can take.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    Post Re: How to get VLookup to keep searching

    Please see attached example
    Attached Files Attached Files

  5. #5
    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,916

    Re: How to get VLookup to keep searching

    Try this:

    =LOOKUP(2,1/(($A$2:$A$4=C2)*($B$2:$B$4<>"")),$B$2:$B$4)

  6. #6
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    Re: How to get VLookup to keep searching

    What about adding in an if statement to tell excel to run another identical Vlookup buttom up instead of bottom down?

  7. #7
    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,916

    Re: How to get VLookup to keep searching

    See post #5.

  8. #8
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    Re: How to get VLookup to keep searching

    I am just getting an error saying "theres a problem with this formula" when I try copy it in. Could you explain how this formula works?

  9. #9
    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,916

    Re: How to get VLookup to keep searching

    Change all the commas to semi-colons for your European locale:

    =LOOKUP(2;1/(($A$2:$A$4=C2)*($B$2:$B$4<>""));$B$2:$B$4)

    Could you explain how this formula works?
    It finds the first match to meet both criteria (column A = C2 and column B is not blank).

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Last edited by AliGW; 07-07-2020 at 11:24 AM.

  10. #10
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    Re: How to get VLookup to keep searching

    Thanks you! That works
    Last edited by AliGW; 07-07-2020 at 11:25 AM. Reason: Please don't quote unnecessarily!

  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,916

    Re: How to get VLookup to keep searching

    You don't need to combine the two - just use the LOOKUP formula.

  12. #12
    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,916

    Re: How to get VLookup to keep searching

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  13. #13
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    Re: How to get VLookup to keep searching

    One more thing before I mark it as solved. I also wish to add in wildcards for Pizza place A, so that the formula works if the place is just called "Place A" for example. I tried to do the following but didnt work?

    =LOOKUP(2;1/(($A$2:$A$4=”*”&C2&”*”)*($B$2:$B$4<>""));$B$2:$B$4)

  14. #14
    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,916

    Re: How to get VLookup to keep searching

    Did you try this?

    =LOOKUP(2;1/(($A$2:$A$4=”*”&C2)*($B$2:$B$4<>""));$B$2:$B$4)

  15. #15
    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,916

    Re: How to get VLookup to keep searching

    If not, attach another workbook.

  16. #16
    Forum Contributor
    Join Date
    04-28-2016
    Location
    Stavanger, Norway
    MS-Off Ver
    365
    Posts
    142

    Re: How to get VLookup to keep searching

    I didnt manage to get it to work
    Attached Files Attached Files

+ 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] Vlookup - Searching for text within a cell
    By bradro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-04-2017, 05:08 PM
  2. VLOOKUP and searching for largest value
    By bikemaniac in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-26-2016, 03:12 AM
  3. vlookup help:searching for a code
    By dangey in forum Excel General
    Replies: 4
    Last Post: 03-23-2010, 09:16 AM
  4. VLOOKUP, searching and filtering
    By haitham1984 in forum Excel General
    Replies: 1
    Last Post: 05-26-2009, 11:02 AM
  5. Searching within VLookup Results
    By smaumau in forum Excel General
    Replies: 2
    Last Post: 05-27-2008, 05:58 PM
  6. Searching / Vlookup
    By asadlone in forum Excel General
    Replies: 2
    Last Post: 12-03-2007, 05:35 AM
  7. vlookup searching
    By Mile029 in forum Excel General
    Replies: 1
    Last Post: 06-06-2007, 11:31 AM

Tags for this Thread

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