+ Reply to Thread
Results 1 to 7 of 7

formula to determine which cell is NOT blank and display that cell's text?

  1. #1
    Registered User
    Join Date
    07-09-2015
    Location
    Los Angeles, CA, USA
    MS-Off Ver
    2010
    Posts
    4

    formula to determine which cell is NOT blank and display that cell's text?

    I have a budget spreadsheet and I'm trying to create a way to automatically categorize it by type based on a keyword search of the Transaction Description column. For example, I'll have a transaction that has the date in A3, the $ amount in B3, and the transaction description (e.g. "Checkcard 0415 Starbucks 09773") in C3.

    My ultimate goal is to create a formula in D3 that I can tailor so that it searches the descriptions in C3 for certain keywords, and if they exist, then it'll assign a corresponding category. I can do this using the IF and ISNUMBER functions. Basically, I tell it that if the keyword "Starbucks" appears in the description cell, then the response if true should be the category "Food," and the response if false is to leave it blank. However, I can only nest up to seven levels of this. For example:

    =IF(ISNUMBER(SEARCH("Starbucks",C16)),"Food",IF(ISNUMBER(SEARCH("Jamba Juice",C16)),"Food",IF(ISNUMBER(SEARCH("Ralphs",C16)),"Groceries",IF(ISNUMBER(SEARCH("Green Tree",C16)),"Mortgage",IF(ISNUMBER(SEARCH("Exxon",C16)),"Gas",IF(ISNUMBER(SEARCH("Subway",C16)),"Food",""))))))

    So my first question is: is there a better way to do this?

    If not, my second question is:

    Let's say I use the above formula, and just use multiple cells to cover all of the keywords possibilities (e.g., 3 cells with 7 nested IF functions, allowing me to automatically categorize up to 21 different types of transactions). I now have the category titles that I want appearing in cells D3, E3, and F3. Can I create a formula in G3 that looks at D3:F3 and determines which one isn't blank, and then displays the text that appears in the non-blank cell? In other words, G3 would summarize whatever answer appeared in D-F (there will be only one cell with text in it)?

    If yes, I could just hide columns D-F and only show column G, which is a cleaned up, vertical list of the responses in D-F. Then I could use column G to help me SUMIF by category. I hope this makes sense. Right now I'm just typing in the category by hand and I want to avoid that step if possible.

    I've attached a sample showing what I've done so far, and then which column I need help with, to get the desired result. Thanks in advance!
    Attached Files Attached Files

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

    Re: formula to determine which cell is NOT blank and display that cell's text?

    Quote Originally Posted by LWSheehan View Post
    I can only nest up to seven levels of this.
    If you're using Excel 2007 or later you can nest up to 64 levels!

    So my first question is: is there a better way to do this?
    Yes!

    I didn't download your file...

    Create a 2 column table with the keywords in the left column and the corresponding category in the right column.

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    2
    3
    7/9/2015
    22.56
    Checkcard 0415 Starbucks 09773
    Food
    Subway
    Food
    4
    ------
    ------
    ------
    ------
    ------
    Starbucks
    Food
    5
    Jamba Juice
    Food
    6
    Ralphs
    Groceries
    7
    Green Tree
    Mortgage
    8
    Exxon
    Gas
    9


    This formula entered in D3:


    =IFERROR(LOOKUP(1E100,SEARCH(F$3:F$8,C3),G$3:G$8),"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: formula to determine which cell is NOT blank and display that cell's text?

    Also:
    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    07-09-2015
    Location
    Los Angeles, CA, USA
    MS-Off Ver
    2010
    Posts
    4

    Re: formula to determine which cell is NOT blank and display that cell's text?

    Ooh, this solution seems like it would be perfect! But it doesn't seem to be working properly for me. i'm not sure what I'm doing wrong. It seems to work for some, but not others:

    screenshot.jpg

  5. #5
    Registered User
    Join Date
    07-09-2015
    Location
    Los Angeles, CA, USA
    MS-Off Ver
    2010
    Posts
    4

    Re: formula to determine which cell is NOT blank and display that cell's text?

    Quote Originally Posted by protonLeah View Post
    Also:
    Please Login or Register  to view this content.
    This is useful, but I still seem to exceed the nesting limits. I think I'm going to need about 30 keywords to make it work, and it doesn't let me nest that many levels even with the OR function...

  6. #6
    Registered User
    Join Date
    07-09-2015
    Location
    Los Angeles, CA, USA
    MS-Off Ver
    2010
    Posts
    4

    Re: formula to determine which cell is NOT blank and display that cell's text?

    Wait, I think I figured out the problem I had with my earlier formula.... and it's working great! I have no idea what it means, though, but I've figured out how to make it work. This is awesome!!! thanks so much

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

    Re: formula to determine which cell is NOT blank and display that cell's text?

    Good deal. Thanks for the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. Replies: 5
    Last Post: 04-09-2014, 10:36 PM
  2. [SOLVED] Sum formula ignore display cell blank
    By Jhon Mustofa in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-30-2014, 07:24 PM
  3. Replies: 11
    Last Post: 11-03-2013, 09:16 PM
  4. Replies: 4
    Last Post: 05-29-2013, 04:18 AM
  5. VBA - Check 3 rows if blank and display text in one of them in adjacent cell
    By guitalex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-17-2012, 09:32 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