"Case of Soda (354mL x 24): USD 25.00 Case of Water (0.500L x 24): USD 15.00"
Using the SumNumbers module adds up all numbers but we only want the dollar values.
Kutools for Excel is a powerful add-in that frees you from performing time-consuming operations in Excel, such as combine sheets quickly, merge cells without losing data, paste to only visible cells, count cells by color and so on. 300+ powerful features / functions for Excel 2019, 2016, 2013, 2010, 2007 or Office 365!
It enables tabbed browsing, editing, and managing of Microsoft Office applications. You can open multiple documents / files in a single tabbed window, such as using the browser IE 8/9/10, Firefox, and Google Chrome. It's compatible with Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365. Demo
Kutools for Outlook is a powerful add-in that frees you from time-consuming operations which majority of Outlook users has to perform daily! It can save your time from using Microsoft Outlook 2019, 2016, 2013, 2010 or Office 365!
Kutools for Word is a powerful add-in that frees you from time-consuming operations which majority of Word users have to perform daily! It can save your time from using Microsoft Word / Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365!
Restores the old look and menus of Office 2003 to Microsoft Office 2019, 2016, 2013, 2010, 2007 or Office 365. Don’t lose time in finding commands on the new Ribbon. Easy to deploy to all computers in enterprises and organizations.
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.
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.
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:
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:
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?.
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: