Adding multiple numbers

Real RFTC

New Member
Joined
Nov 16, 2021
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
I can't figure out a simple way to add these numbers I plug in for each day to get my total amount for the week. auto sum and selecting "B3-G3" doesn't work... There has to be a way so I don't have to use a calculator and add everything up to get my total....
 

Attachments

  • Screenshot 2021-11-16 161456.png
    Screenshot 2021-11-16 161456.png
    6.5 KB · Views: 9

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I have not tried but this was mentioned before and also a site talk about it

For me, it is easier to use UDF
Book1
ABCDEF
130, 150148, 99, 3045, 130, 5382, 5496, 56, 8214, 99, 58, 30
2
31256
Sheet1
Cell Formulas
RangeFormula
A3A3=CommaAdd(A1:F1)


VBA Code:
Function CommaAdd(rng As Range) As Long

Dim s As String
Dim e As Variant, A As Variant
Dim cell As Range

For Each cell In rng
    s = s & "," & Trim(cell)
Next
A = Split(s, ",")
For Each e In A
    If Not e = "" Then CommaAdd = CommaAdd + Trim(e)
Next

End Function
 
Upvote 0
If you don't want VBA, then use this formula at the end of the week (column G)

Excel Formula:
=SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(A2;",";REPT(" ";99));IF(SEQUENCE(LEN(A2)-LEN(SUBSTITUTE(A2;",";""))+1)=1;1;(SEQUENCE(LEN(A2)-LEN(SUBSTITUTE(A2;",";""))+1)-1)*99);99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(B2;",";REPT(" ";99));IF(SEQUENCE(LEN(B2)-LEN(SUBSTITUTE(B2;",";""))+1)=1;1;(SEQUENCE(LEN(B2)-LEN(SUBSTITUTE(B2;",";""))+1)-1)*99);99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(C2;",";REPT(" ";99));IF(SEQUENCE(LEN(C2)-LEN(SUBSTITUTE(C2;",";""))+1)=1;1;(SEQUENCE(LEN(C2)-LEN(SUBSTITUTE(C2;",";""))+1)-1)*99);99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(D2;",";REPT(" ";99));IF(SEQUENCE(LEN(D2)-LEN(SUBSTITUTE(D2;",";""))+1)=1;1;(SEQUENCE(LEN(D2)-LEN(SUBSTITUTE(D2;",";""))+1)-1)*99);99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(E2;",";REPT(" ";99));IF(SEQUENCE(LEN(E2)-LEN(SUBSTITUTE(E2;",";""))+1)=1;1;(SEQUENCE(LEN(E2)-LEN(SUBSTITUTE(E2;",";""))+1)-1)*99);99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(F2;",";REPT(" ";99));IF(SEQUENCE(LEN(F2)-LEN(SUBSTITUTE(F2;",";""))+1)=1;1;(SEQUENCE(LEN(F2)-LEN(SUBSTITUTE(F2;",";""))+1)-1)*99);99)))))


MrExcel.xlsx
ABCDEFG
1MonTueWedThuFriSatTotal
230, 150148, 99, 3045, 130, 5382, 5496, 56, 8214, 99, 58, 301256
Sheet1
Cell Formulas
RangeFormula
G2G2=SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(A2,",",REPT(" ",99)),IF(SEQUENCE(LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1)=1,1,(SEQUENCE(LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1)-1)*99),99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(B2,",",REPT(" ",99)),IF(SEQUENCE(LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1)=1,1,(SEQUENCE(LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1)-1)*99),99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(C2,",",REPT(" ",99)),IF(SEQUENCE(LEN(C2)-LEN(SUBSTITUTE(C2,",",""))+1)=1,1,(SEQUENCE(LEN(C2)-LEN(SUBSTITUTE(C2,",",""))+1)-1)*99),99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",99)),IF(SEQUENCE(LEN(D2)-LEN(SUBSTITUTE(D2,",",""))+1)=1,1,(SEQUENCE(LEN(D2)-LEN(SUBSTITUTE(D2,",",""))+1)-1)*99),99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(E2,",",REPT(" ",99)),IF(SEQUENCE(LEN(E2)-LEN(SUBSTITUTE(E2,",",""))+1)=1,1,(SEQUENCE(LEN(E2)-LEN(SUBSTITUTE(E2,",",""))+1)-1)*99),99)))))+SUMPRODUCT(--(1*(TRIM(MID(SUBSTITUTE(F2,",",REPT(" ",99)),IF(SEQUENCE(LEN(F2)-LEN(SUBSTITUTE(F2,",",""))+1)=1,1,(SEQUENCE(LEN(F2)-LEN(SUBSTITUTE(F2,",",""))+1)-1)*99),99)))))
 
Last edited:
Upvote 0
For me, it is easier to use UDF
Book1
ABCDEF
130, 150148, 99, 3045, 130, 5382, 5496, 56, 8214, 99, 58, 30
2
31256
Sheet1
Cell Formulas
RangeFormula
A3A3=CommaAdd(A1:F1)


VBA Code:
Function CommaAdd(rng As Range) As Long

Dim s As String
Dim e As Variant, A As Variant
Dim cell As Range

For Each cell In rng
    s = s & "," & Trim(cell)
Next
A = Split(s, ",")
For Each e In A
    If Not e = "" Then CommaAdd = CommaAdd + Trim(e)
Next

End Function
If the range being processed is always horizontal like your example showed, then your function can be written more compactly like this...
VBA Code:
Function CommaAdd(R As Range) As Double
  CommaAdd = Evaluate(Join(Split(Join(Application.Index(R.Value, 1, 0), ","), ","), "+"))
End Function
 
Upvote 0
If the range being processed is always horizontal like your example showed, then your function can be written more compactly like this...
VBA Code:
Function CommaAdd(R As Range) As Double
  CommaAdd = Evaluate(Join(Split(Join(Application.Index(R.Value, 1, 0), ","), ","), "+"))
End Function
Thanks. Not aware of Join command and the way to implement it ?
 
Upvote 0
Another possible formula
+Fluff 1.xlsm
ABCDEFG
1MonTueWedThuFriSatTotal
230, 150148, 99, 3045, 130, 5382, 5496, 56, 8214, 99, 58, 301256
Data
Cell Formulas
RangeFormula
G2G2=SUMPRODUCT(FILTERXML("<k><m>"&SUBSTITUTE(CONCATENATE(A2,",",B2,",",C2,",",D2,",",E2,",",F2),",","</m><m>")&"</m></k>","//m"))
 
Upvote 0
Solution
Another possible formula
+Fluff 1.xlsm
ABCDEFG
1MonTueWedThuFriSatTotal
230, 150148, 99, 3045, 130, 5382, 5496, 56, 8214, 99, 58, 301256
Data
Cell Formulas
RangeFormula
G2G2=SUMPRODUCT(FILTERXML("<k><m>"&SUBSTITUTE(CONCATENATE(A2,",",B2,",",C2,",",D2,",",E2,",",F2),",","</m><m>")&"</m></k>","//m"))
This code was very simple and got my fix! Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

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