Extract multiple dollar amounts from text in a cell and add together

TrishaL

Board Regular
Joined
Jul 9, 2013
Messages
56
Office Version
  1. 2019
Platform
  1. Windows
I have cells where there is text and money amounts. I want to extract the money amounts into another cell and if possible, even add the amounts together and give me the total.
Here are couple examples of how it is entered in a cell:
Example 1:
$20,000.00 - Adverse Effect - PAID; $63,000.00 - Tree Loss - PAID; $10,000.00 - Access - PAID; $5,000.00 - Appraisal - PAID; $5,000.00 - Hay Loss - PAID; $5,000.00 - Disturbance - PAID; $5,000.00 - LO Time - PAID; $5,000.00 - Severance - PAID

Example 2:
$12,000.00 - Loss of shelter belt
$7,000.00 - Timber loss
$2,500.00 - Moving equipment
$1,500.00 - Crop loss

Looking for the money to be extracted out so it looks like this: $20,000.00; $63,000.00; $10,000.00; and so on. If possible it would be great to just get the sum of all amounts because my end goal is to pull out the money amount and add together so that I can get a total for all of my rows.

I should point out that not all money is entered the same. There may not be the $ or the .00 or the comma.

If anyone has an idea on if I can do this it would be appreciated. Thank you in advance.
 
No, these are vba functions, not worksheet functions.


Probably a good idea to do that, depending on what version(s) you have of course.
Worth updating your profile so others know that information?
excel 2016, done.
With Evaluate(formula), I guess formula must be worksheet function, not VBA.
I will test it with my 2016 version.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Thanks for updating. (y)


You could test this user-defined function. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below (you can use the icon at the top right of the code pane below) into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down. You could format that column with $/commas/decimal places as desired
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

VBA Code:
Function SumDollars(s As String) As Double
  SumDollars = Evaluate(Replace(Replace(Join(Filter(Split(Replace("$0 " & s, vbLf, " ")), "$"), "+"), "$", ""), ",", ""))
End Function

TrishaL.xlsm
AB
1DataSum
2$20,000.00 - Adverse Effect - PAID; $63,000.00 - Tree Loss - PAID; $10,000.00 - Access - PAID; $5,000.00 - Appraisal - PAID; $5,000.00 - Hay Loss - PAID; $5,000.00 - Disturbance - PAID; $5,000.00 - LO Time - PAID; $5,000.00 - Severance - PAID118000
3$12,000.00 - Loss of shelter belt $7,000.00 - Timber loss $2,500.00 - Moving equipment $1,500.00 - Crop loss23000
40
5No dollars0
6$10,000.00 - Tree loss10000
7$30,000 - Fencing30000
8$1000 - Fencing1000
9$3,600.00 - Access Road - PAID; $5,000 - Time/Inconv - PAID; $66,691.20 - Timber - PAID; $5,769.58 - Professional Services (#3) - PAID81060.78
Sheet1
Cell Formulas
RangeFormula
B2:B9B2=SumDollars(A2)
Thank you very much for this. This worked wonderfully and I was able to get what I needed. This saved me so much time! Again, thank you!
 
Upvote 0

Forum statistics

Threads
1,215,365
Messages
6,124,513
Members
449,168
Latest member
CheerfulWalker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top