How to sum the total for 1(1A) + 3(3A) + 5 = 9(4A) ?

jcmt427

New Member
Joined
May 20, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
How to sum the total for 1(1A) + 3(3A) + 5 = 9(4A) ?

other examples:

1(1A) + 3(2A) = 4(3A)

10(2A) + 1 = 11(2A)

I need to sum at least 100 cells in the Excel (same column or same row).

Thank you.
 

Attachments

  • test.PNG
    test.PNG
    3.1 KB · Views: 13

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello
Try this macro
VBA Code:
Sub SUM_TEXT()
Dim ur As Long, i As Long, nr, n1, n2
ur = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To ur
  On Error Resume Next
  nr = Split(Cells(i, 1), "(")
  If UBound(nr) > 0 Then
    n2 = n2 + Val(nr(1))
  End If
  On Error GoTo 0
  n1 = n1 + Val(nr(0))
Next i
Cells(2, 3) = n1 & "(" & n2 & Right(nr(1), 2)
End Sub

Let me know. Hello,
Mario
 
Upvote 0
Solution
Many thanks for your swift response, it works :)

just one more question, is it possible to use formula to get the same answer as the code above ?

Thank you very much in advance.
 
Upvote 0
Hello
The formula in ITALIAN is the following:
=MATR.SOMMA.PRODOTTO(SINISTRA(A1:A5;SE.ERRORE(TROVA("(";A1:A5)-1;1))*1)&"("&MATR.SOMMA.PRODOTTO(SOSTITUISCI(SE.ERRORE(STRINGA.ESTRAI(A1:A5;TROVA("(";A1:A5)+1;100);0);"B)";"")*1)&"B)"

which I tried to "translate" like this:
=SUMPRODUCT(LEFT(A1:A5,IFERROR(FIND("(",A1:A5)-1,1))*1&"("&SUMPRODUCT(SUBSTITUTE(IF ERROR(MID(A1:A5,FIND("(",C2:C9)+1,100),0),"B)","")*1)&"B)"

Keep in mind two things:
1 °) is a matrix formula to be confirmed with Ctrl + Shift + Enter
2 °) the ";" in Italian it must be changed to ","

Hope this helps.
Hello,
Mario
 
Upvote 0
Hello
The formula in ITALIAN is the following:
=MATR.SOMMA.PRODOTTO(SINISTRA(A1:A5;SE.ERRORE(TROVA("(";A1:A5)-1;1))*1)&"("&MATR.SOMMA.PRODOTTO(SOSTITUISCI(SE.ERRORE(STRINGA.ESTRAI(A1:A5;TROVA("(";A1:A5)+1;100);0);"B)";"")*1)&"B)"

which I tried to "translate" like this:
=SUMPRODUCT(LEFT(A1:A5,IFERROR(FIND("(",A1:A5)-1,1))*1&"("&SUMPRODUCT(SUBSTITUTE(IF ERROR(MID(A1:A5,FIND("(",C2:C9)+1,100),0),"B)","")*1)&"B)"

Keep in mind two things:
1 °) is a matrix formula to be confirmed with Ctrl + Shift + Enter
2 °) the ";" in Italian it must be changed to ","

Hope this helps.
Hello,
Mario
Thank you so much for your kind assistance :)
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

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