Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to sum values based on text criteria in Excel?

In Excel, have you ever tried to sum values based on another column of text criteria? For example, I have a range of data in worksheet as following screenshot shown, now, I want to add up all the numbers in column B corresponding with the text values in column A that meet a certain criterion, such as sum the numbers if the cells in column A contains KTE.

doc-sum-based-on-text-1

Sum the values based on another column if contains certain text

Sum the values based on another column if starts with certain text

Sum the values based on another column if ends with certain text

Sum the values based on another column if only is certain text


Advanced Combine Rows:(Combine duplicate rows and sum / average corresponding values):
  • 1. Specify the key column that you want to combine other column based on;
  • 2. Choose one calculation for your combined data.
  • doc-sum-columns-one-criteria-7

    Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


    arrow blue right bubble Sum the values based on another column if contains certain text


    Let’s take the above data for example, to add all the values together which contains the text “KTE” in column A, the following formula may help you:

    Please enter this formula =SUMIF(A2:A6,"*KTE*",B2:B6) into a blank cell, and press Enter key, then all the numbers in column B where the corresponding cell in column A contains text “KTE” will add up. See screenshots:

    doc-sum-based-on-text-2
    -1
    doc-sum-based-on-text-3

    Tip: In the above formula, A2:A6 is the data range which you add the values based on, *KTE* stands for the criteria you need, and B2:B6 is the range you want to sum.


    arrow blue right bubble Sum the values based on another column if starts with certain text

    If you just want to sum the cell values in column B where the corresponding cell in column A which text starts with “KTE”, you can apply this formula: =SUMIF(A2:A6,"KTE*",B2:B6), see screenshots:

    doc-sum-based-on-text-4
    -1
    doc-sum-based-on-text-5

    Tip: In the above formula, A2:A6 is the data range which you add the values based on, KTE* stands for the criterion you need, and B2:B6 is the range you want to sum.


    arrow blue right bubble Sum the values based on another column if ends with certain text

    To add up all the values in column B where the corresponding cell in column A which text ends with “KTE”, this formula can do you a favor: =SUMIF(A2:A6,"*KTE",B2:B6), (A2:A6 is the data range which you add the values based on, KTE* stands for the criterion you need, and B2:B6 is the range you want to sum)see screenshots:

    doc-sum-based-on-text-6
    -1
    doc-sum-based-on-text-7

    arrow blue right bubble Sum the values based on another column if only is certain text

    If you just want to sum the values in column B which corresponding cell content only is “KTE” of column A, please use this formula: =SUMIF(A2:A6,"KTE",B2:B6), (A2:A6 is the data range which you add the values based on, KTE stands for the criterion you need, and B2:B6 is the range you want to sum) and then only the text is “KTE” in column A which relative number in column B will add up, see screenshots:

    doc-sum-based-on-text-8
    -1
    doc-sum-based-on-text-9

    Related articles:

    How to sum every n rows down in Excel?

    How to sum cells with text and numbers in Excel?


    Recommended Productivity Tools

    Ribbon of Excel (with Kutools for Excel installed)

    300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

    Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

    •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
    •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
    •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
    •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
    •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
    •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
    •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
    •  Change the way you work now, and give you a better life immediately!

    Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

    • Increases your productivity by 50% when viewing and editing multiple documents.
    • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
    • Open and create documents in new tabs of same window, rather than in new windows.
    • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
    Say something here...
    symbols left.
    You are guest ( Sign Up? )
    or post as a guest, but your post won't be published automatically.
    Loading comment... The comment will be refreshed after 00:00.
    • To post as a guest, your comment is unpublished.
      Jordan · 7 months ago
      how do I use a sumif in the following. If a certain cell contains the values of an substring of data, than sum a nearby column. for example, Cell A1 has (Dan,Tom,Bill,Smith). Then a separate table has Dan - 2, Bill - 3, John - 4. Assuming that is a 2x3 table. I want to create a formula that can sum the Dan and Bill numbers (2+3) because those texts could be found in cell A1. So the total would return 5.
    • To post as a guest, your comment is unpublished.
      Lisa Matusiak · 8 months ago
      How do you us sumif formula to with two criteria? For instance, If Column A = X and Column C = C then Sum Column G.
    • To post as a guest, your comment is unpublished.
      Lucky Arora · 11 months ago
      Hi, any one here is having an idea of how to calculate value containing in a cell (Or with text?
      For Example: in Cell A= MR134 , B= MR143, C = MR187 and result will be like sum of 134+143+187 =?
      • To post as a guest, your comment is unpublished.
        Zahirul · 27 days ago
        I am looking for this solution too.
        • To post as a guest, your comment is unpublished.
          skyyang · 27 days ago
          Hello, guys,
          May be the below array formula can help you: (after typing the formula, please press Ctrl+Shift+Enter together)
          =SUM(IF(ISNUMBER(SEARCH("MR",B1:B4)),SUBSTITUTE(B1:B4,"MR",""))+0)
          Please change the cell references to your need.
    • To post as a guest, your comment is unpublished.
      Hector · 1 years ago
      This is super clear and understandable, thank you so much!!!
    • To post as a guest, your comment is unpublished.
      Tom · 1 years ago
      This was super helpful :)