+ Reply to Thread
Results 1 to 4 of 4

Addind values if text is contained in cells

  1. #1
    Registered User
    Join Date
    08-04-2011
    Location
    Bordeaux, France
    MS-Off Ver
    Excel 2007
    Posts
    5

    Addind values if text is contained in cells

    Hey guys,

    So here's the deal :

    In my first tab, I have some raw data that is presented as such :

    Column A contains text
    Column B contains numbers

    So that gives us something like :

    text1 8
    text2 19
    text3 7

    etc.

    Now here's what I want to do :
    In the cell C1 I will enter a text value.
    I'd like to have a formula that is gonna check the entire A column for cells that CONTAIN (not strickly equal) the text value I put in C1. Everytime the C1 value is present in a cell in the column A, the number in the column B is added to the sum.

    For example, if I put "potato" in C1, and my A and B columns are as follow :

    potato chip 8
    potato 9
    salad 8
    food 3
    potatos 1

    The formula should give me the result 8+9+1 = 18

    Any idea how to get there ?

    Thanks,
    Last edited by Ranu; 02-03-2012 at 11:23 AM. Reason: Solved

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Addind values if text is contained in cells

    Hi,

    in C1 "POTATO", in A1:A1000 the potato strings.

    The formula sums the numbers after the first space.

    Please Login or Register  to view this content.
    to be confirmed with control+shift+enter

    Regards
    Attached Files Attached Files
    Last edited by canapone; 02-03-2012 at 10:53 AM.
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Addind values if text is contained in cells

    Perhaps:

    =SUMIF($A$1:$A$10,"*"&C1&"*",$B$1:$B10)

    adjust ranges to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    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: Addind values if text is contained in cells

    Hi

    Using a helper column, you can use simple formula, to get your result.

    In D1(Or enywhere else), put the formula.

    =IF(ISERROR(SEARCH($C$1;A1));0;1)

    Then, usung this simple formula, you get your result.

    =SUMIF(D1:D5;"=1";B1:B5)

    Hope to helps you.
    Attached Files Attached Files
    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.

+ 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