+ Reply to Thread
Results 1 to 6 of 6

Vlookup. IF a word from a list is in the string of a cell

  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    Chicago, IL
    MS-Off Ver
    2016
    Posts
    29

    Vlookup. IF a word from a list is in the string of a cell

    I'm trying to make an easier way to categorize my spending in excel. You know how the bank describes a purchase as random things like "MERCHANT PAYMENT CITY FRESH MARKE - 5ON 010622 FROM CARD#: XXXXXXXXXXXX464X" and "MERCHANT PAYMENT - JEWEL OSCO ON 011022 FROM CARD#: XXXXXXXXXXXX464X"?

    So I want to have a list that says IF the string in cell ?? contains "JEWEL", it should return a string of "Groceries". And if it contains "CITY FRESH", it should be "Bakery". Etc.

    I uploaded an example to https://docs.google.com/spreadsheets...it?usp=sharing.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Vlookup. IF a word from a list is in the string of a cell

    A nested formula will become very convoluted if you have more than a half dozen criteria. I suggest that a VBA solution may be more realistic. How many criteria do you have for this project and do you anticipate having more? If you are open to a VBA solution, then post back and I will offer one up.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    04-14-2015
    Location
    Chicago, IL
    MS-Off Ver
    2016
    Posts
    29

    Re: Vlookup. IF a word from a list is in the string of a cell

    Thanks Alan!

    I'm open to any solutions. I was planning on keeping this in google sheets, but would happily use anything.

    With a VBA solution, I can save it to that sheet and it will continue to function, correct?

  4. #4
    Registered User
    Join Date
    04-14-2015
    Location
    Chicago, IL
    MS-Off Ver
    2016
    Posts
    29

    Re: Vlookup. IF a word from a list is in the string of a cell

    Sorry - to answer the question, I have many and I plan on adding more as I see repeat vendors that I buy from.

  5. #5
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Vlookup. IF a word from a list is in the string of a cell

    If your list would be unique then you can use a reference table as per the other thread you posted in. e.g. in D2 of your sample sheet:

    =IFERROR(INDEX($J$2:$J$6,MATCH(1,--ISNUMBER(SEARCH($I$2:$I$6,B2)),0)),"")

    Note that this needs exact matches from your lookup table, in your sample you have "Fresh Market" in the lookup but the description is truncated as "FRESH MARKE" so it doesn't match.

    Also this doesn't deal with anything that meets multiple criteria; it will just categorise as the first one in your table that is triggered.

  6. #6
    Registered User
    Join Date
    04-14-2015
    Location
    Chicago, IL
    MS-Off Ver
    2016
    Posts
    29

    Re: Vlookup. IF a word from a list is in the string of a cell

    Thank you.

    What I ended up using is;

    =VLOOKUP(LOOKUP(2^15,SEARCH(Sheet1!$A$2:$A$41,B4),Sheet1!$A$2:$A$41),Sheet1!A:B,2,0)

+ 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] If a cell contains a specific word, return pre defined string for that word.
    By slamont in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-23-2022, 01:19 PM
  2. [SOLVED] Find a Word in a Text String From a List
    By thenewkidd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2022, 02:13 PM
  3. Use VLOOKUP when your lookup_value is a multi-word string
    By amarkert22 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-04-2018, 10:14 PM
  4. [SOLVED] Extract a word starts with a list of characters from a string
    By suchetherrah in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 11-03-2016, 09:18 AM
  5. Replies: 3
    Last Post: 09-28-2015, 07:35 AM
  6. Replies: 2
    Last Post: 08-05-2013, 04:45 PM
  7. Word List and Count from a string
    By Patchworks in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-31-2008, 02:53 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