+ Reply to Thread
Results 1 to 7 of 7

Finding a specific word in a cell and executing an array

  1. #1
    Registered User
    Join Date
    12-31-2009
    Location
    NH
    MS-Off Ver
    Excel 2003
    Posts
    18

    Finding a specific word in a cell and executing an array

    I hope the title explains ok.

    I am playing with my sheet some more and basically I have a "list" of items to choose from in H5:H34.

    List Contains below:
    Full - CASH
    Full - CHECK
    Full - VISA
    Full - MC.
    Full - Disc.
    Full - Amex
    Balance - CASH
    Balance - CHECK
    Balance - VISA
    Balance - MC
    Balance - DISC.
    Balance - AMEX
    Deposit - CASH
    Deposit - CHECK
    Deposit - VISA
    Deposit - MC
    Deposit - DISC.
    Deposit - AMEX
    Refund
    Quote


    I want an array formula that I can use that will allow excel to search for the word "cash" (Or VISA,CHECK,MC, etc..) in column H5:H34 which will have other words such as (Balance, Deposit, Full, etc. ) in the same cell and then add up some dollar amounts in column J5:J34.

    My code right now that I was trying which has failed. (This code is in the Cash cell which adds up all dollar amounts put in with cash)
    Please Login or Register  to view this content.
    This portion is what I really need
    IF(MATCH(H5:H34="cash",-J5:J34)),IF(MATCH(H5:H34="cash",J5:J34))

    MATCH I believe is the wrong thing to use as I read it only gives you a "position" of where something is.
    Last edited by jgray152; 01-09-2010 at 05:34 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding a specific word in a cell and executing an array

    The most basic part of your question is SUMIF():

    =SUMIF(H5:H34, "*CASH*", J5:J34)

    You can string other SUMIF()s together to subtract other stuff, or you can try to construct a SUMPRODUCT() to do it:

    =SUMPRODUCT(--(H5:H34="*cash*"), --(H5:H34<>"refund - cash"), J5:J34)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-31-2009
    Location
    NH
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Finding a specific word in a cell and executing an array

    Gosh.... thats it? haha

    What does it mean when you put in "<>" in the following ?
    --(H5:H34<>"

  4. #4
    Registered User
    Join Date
    12-31-2009
    Location
    NH
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Finding a specific word in a cell and executing an array

    So I did the following

    =SUM(IF(H5:H34="",,(IF(H5:H34="quote",,IF(H5:H34="refund - cash",SUMIF(H5:H34, "*CASH",J5:J34),SUMIF(H5:H34, "*CASH", J5:J34))))))

    For some reason if there is ANY selection made in more than one cell in the H5:H34 column it will multiply the summed number by however many cells are filled in in Column H5:H34

    so in H5:H34, if H5 says "FULL - CASH" and J5 says "$10.00" and H6 says "FULL - VISA" and J6 says "$300.00" basically the CASH summed cell will say $20.00 and the VISA summed cell will say $600.

    If I only have H5 and J5 entered, than it will return the value $10.00 in the CASH summed cell which is correct.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding a specific word in a cell and executing an array

    I don't know what you're trying to do with that long version of your formula.

    Click GO ADVANCED and use the paperclip icon to post up a sample of your actual workbook. Make sure the sample data is clear and manually mockup the answers you're looking for (no formulas there, please, just the answer and explanatory logic if it's not obvious.)

  6. #6
    Registered User
    Join Date
    12-31-2009
    Location
    NH
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Finding a specific word in a cell and executing an array

    I think I just had a blonde moment. After looking at it again, I don't know why I was using such a long formula as well. It works so far.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding a specific word in a cell and executing an array

    Quote Originally Posted by jgray152 View Post
    Gosh.... thats it? haha

    What does it mean when you put in "<>" in the following ?
    --(H5:H34<>"
    <> in an Excel formula means "greater than or less than" or "is any value other than..."


    =A1<>"dog" means "this is TRUE if cell A1 does NOT have the value 'dog' "

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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