Adding multiple numbers in the same cell

bmwbuyer2007

Board Regular
Joined
Jul 19, 2007
Messages
82
Hi all,

Just wondering if it is possible to add numbers which are in the same cell, seperated by commas, for example

A B
1 Person 1 10, 10, 15
2 Person 2 10
3 Person 3 10, 10
4 Total 65

I know I could just put each number in a different cell, but for some reason the powers that be don't want to do this :)

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi,Give this a try,
Numbers in column "B"
Code:
Dim cl As Range, oSum, s As Integer, Tot As Double
For Each cl In Range(Range("b1"), Range("b" & Rows.Count).End(xlUp))
oSum = Split(cl, ",")
If InStr(cl, ",") > 0 Then
   For s = 0 To UBound(oSum)
        Tot = Tot + oSum(s)
      Next s
    Else
   Tot = Tot + cl
End If
Next cl
MsgBox Tot
Regards Mick
 
Upvote 0
Hi bmwbuyer2007

You can use this UDF:

Code:
Function SumComma(s As String)
    SumComma = Evaluate(Replace(s, ",", "+"))
End Function

Use it as any other worksheet function, like:

=SumComma(B1)
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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