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 cells with text and numbers in Excel?

For example, I have a list of values containing numerical and textual strings, now, I want to sum only the numbers based on the same text, look at the following screenshot. Normally, you can’t sum the values in the list with text string directly, here, I will introduce you some formulas to deal with this task.


Split / Separate text strings into individual text and number columns:

Kutools for Excel’s Split Cells feature is a powerful tool, it can help you to split cell values into multiple columns or rows, it can help you to slit alphanumeric strings into separated text and numbers columns, etc…

doc sum text number 8

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!


Sum cells containing text and numbers based on the certain text with formula


Excel Productivity Tools

Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial

Kutools for Excel: Save 70% of your time and solve 80% Excel problems for you. 300+ advanced features designed for 1500+ work scenario, make Excel much easy and increase productivity immediately.60-day Unlimited Free Trial


You can use an array formula to sum the numbers based on their corresponding text string within the cell, please do as follows:

1. First you can write down your text strings you want to sum the relative numbers in a column cells.

doc sum text number 2

2. Then type below formula in a blank cell, in this example, I will enter the formula in cell E1: =SUM(IF(ISNUMBER(FIND(D1,$B$2:$B$8)),VALUE(LEFT($B$2:$B$8,FIND(D1,$B$2:$B$8)-1)),0)), and then press Ctrl + Shift + Enter keys together, it will return the total value from the list based on the certain text. See screenshot:

doc sum text number 3

Tip: In the above formula, D1 is the criterion which you want to use, and B2:B8 indicates the cell range you want to sum.

3. Then select the formula cel, and drag the fill handle down to the cells you want to apply this formula to get the result:

doc sum text number 4


Sum cells containing text and numbers ignoring the text with User Defined Function


If you have the following data which is mixed with text and numbers, and you just want to extract and add up only the numbers in each cell, how could you quickly finish this in Excel?.

doc sum text number 5

To deal with this problem, you can create a User Defined Function, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: sum only the numbers in the cell containing numbers and text

Function SumNumbers(rngS As Range, Optional strDelim As String = " ") As Double
'Update 20141210
    Dim xNums As Variant, lngNum As Long
    xNums = Split(rngS, strDelim)
    For lngNum = LBound(xNums) To UBound(xNums) Step 1
        SumNumbers = SumNumbers + Val(xNums(lngNum))
    Next lngNum
End Function

3. Then save and close this code, go back to the worksheet, and enter this formula =SumNumbers(A1) (A1 indicates the cell you want to sum up the numbers), then drag the fill handle down to the cells you want to fill the formula, and only numbers in each cell are added together, see screenshot:

doc sum text number 6


Sum all individual numbers within a cell

Sum all individual numbers within a cell

If you want to add up all numbers within a cell, Kutools for Excel’s Sum numbers in a cell can help you quickly sum all digits of a number together in a cell.

doc sum text number 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!


Related articles:

How to sum every n rows down in Excel?

How to sum values based on text criteria in Excel?


Excel Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 70%, 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 80% 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.
    jasmeet · 1 months ago
    In this formula =SUM(IF(ISNUMBER(FIND(D1,$B$2:$B$8)),VALUE(LEFT($B$2:$B$8,FIND(D1,$B$2:$B$8)-1)),0)) can be put a range in place of D1 - say D1:D5 - not getting result, if i put it this way. What is the correct way to do this?
  • To post as a guest, your comment is unpublished.
    NP · 2 months ago
    Hi, I want to be able to add a number and also text to one cell (C5 all the way to C16) then get only the numbers in there to add up. But the =SumNumbers(A1) formula doesn't seem to work.
  • To post as a guest, your comment is unpublished.
    Emmy du Plooy · 6 months ago
    Hi, I hope someone can help. I like to add inside the cell +100j+50f+600m but must display/add on cell as 750 only. So you see 750 in cell but when press F2, it will show =100j+50f+600m
  • To post as a guest, your comment is unpublished.
    David · 7 months ago
    Hi. Please can someone help me. I am trying to SUM a column in EXCEL that has numbers and letters. eg 8.1km, 10.5km etc. There are 1031 lines or cells in the column. I am using this formula =SUM(LEFT(D3),LEN(D3)-2+LEFT(D4),LEN(D4)-2) which works if i want to add 2 or 3 cells together but i cant use this for 1031 cells. i wanted to add a : in place of the + but it comes back with an error and will not allow me to create the formula. Any help will be greatly appreciated
  • To post as a guest, your comment is unpublished.
    Mrityunjay · 1 years ago
    Hi,
    How to multiply 10 pcs *200,

    not 10*200