+ Reply to Thread
Results 1 to 16 of 16

Sum, if a column CONTAINs certain word

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Sum, if a column CONTAINs certain word

    Hi,
    I've been searching this forum for a possible solution for my problem, but it all seems to be just a bit off for me. I am really hoping somebody can help me, it drives me nuts!
    Here's my problem:
    Column B contains description
    Column C contains corresponding value

    I want to have 1 cell, where I can get a result of the following:
    if column B (alphanumeric) CONTAINS word "ABC", then ADD all corresponding values in column C into one 1 number and display.

    I tried the following:
    =SUMIF($B$9:$B$182;ISNUMBER(SEARCH("brk";$B$9:$B$182));$C$9:$C$182)

    It seems that it should work, but I think the Search function doesn't like to be an array formula... or may be I am way off!

    Thank you in advance!

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum, if a column CONTAINs certain word

    Try

    =SUMIF(B1:B100,"*ABC*",C1:C100)

    Edit: =SUMIF(B1:B100,"*ABC*",C1:C100)

    =SUMIF(B9:B1182,"*ABC*",C9:C182)
    Last edited by Fotis1991; 11-06-2012 at 02:35 AM. Reason: Edit
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Sum, if a column CONTAINs certain word

    Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Sum, if a column CONTAINs certain word

    Hi Candl66,

    Welcome to the forum.

    Try using below formula:-

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See attached:- sum if text present.xlsx

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  5. #5
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    Fotis,
    I tried that before, tested again. Gives me 0 as a result. Thank you very much!

  6. #6
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    Dili,
    You are a genius!! Thank you. Works (only as an array formula) like a charm! Could you tell me how you thought of it? What's the logic? Thanks again!

  7. #7
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    Abousetta

    It gives me 0 as a result. Thank you very much for your help!

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Sum, if a column CONTAINs certain word

    you are welcome Candl66..

    the part SEARCH("ABC",$B$2:$B$4) searches the ABC in B2:B4 and if found it gets the position number of ABC in that cell.. now ISNUMBER(SEARCH("ABC",$B$2:$B$4) checks if that is actually a number and where it gets a number that becomes True else all becomes False.. trues are actually 1s and Falses are 0s.. and then * signs ensures that the values from $C$2:$C$4 gets collected and multiplied previously colllected 1s and 0s.. so 0 multiplication results in 0 and 1 multiplication results in the number, which we are supposed to take sum of..at the end sum{ array } ensures collected numbers gets summed up to produce your desired result

    I hope this is not much confusing

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sum, if a column CONTAINs certain word

    I would expect the SUMIF+wildcard approach to work, as suggested by abousetta and Fotis, are you sure that doesn't work? Can you post the exact formula you tried? If it really doesn't work that probably means that the "numbers" in the sum range are not real numbers but text strings....
    Audere est facere

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum, if a column CONTAINs certain word

    ...Fotis,
    I tried that before, tested again. Gives me 0 as a result. Thank you very much!
    No. Does not give 0. Gives the correct result. Abusseta's formula gives also correct result. And as daddylonglegs said:

    ...if it really doesn't work that probably means that the "numbers" in the sum range are not real numbers but text strings....
    But you told us that
    ...if column B (alphanumeric) CONTAINS word "ABC", then ADD all corresponding values in column C into one 1 number and display.
    It's ok to prefer an Array formula or anything you want but not because the other solutions don't work!
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    Fotis,
    I am not sure what to tell you, but that formula was the one I tried myself and it didn't work. That is why I turned to this forum for help. I really appreciate your help. May be because I am using Google docs, it's different? I thought they were pretty much the same with Excel, as I was able to to use all the same formulas in the past. But, I've tried it again and again, with array or not, it gives me 0 as a result. Why would I lie to you?
    Thanks,
    candl66

  12. #12
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    Dili,
    Makes total sense, thanks!

  13. #13
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    Fotis,
    the file you attached is a perfect example that the sumif doesn't work. At least not on my computer. Does it do the right thing on yours?

  14. #14
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sum, if a column CONTAINs certain word

    Some Excel functions may work differently or not at all in Google docs......but SUMIF works OK for me in Google docs as it does in excel. Are you saying that the formulas in Fotis' example give you different results?
    Last edited by daddylonglegs; 11-06-2012 at 06:36 PM.

  15. #15
    Registered User
    Join Date
    11-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Sum, if a column CONTAINs certain word

    yep. Both give me a result of 0, but the Dili's. very strange

  16. #16
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum, if a column CONTAINs certain word

    Of course in 5 differents computer that i tested gives me the correct result. All three formulas give 4 as result.

    In 99.9% of my formula suggestions, i test these at least one time before post. That i also did in this case.

    Isue is closed for me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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