The most efficient way to SUM() a series of substrings

stonypaul

Board Regular
Joined
Jan 4, 2008
Messages
86
If in column R I have a 6 digit numeric string in each cell like below what would be the most efficient way to calculate the total of the first two digits, then the 2nd two, then the 3rd two, other than using a lengthy formulae for each cell like these

=LEFT(R1,1) + MID(R1,2,1)
=MID(R1,3,1) + MID(R1,4,1)
=MID(R1,5,1) + MID(R1,6,1)

I have experimented with =SUMIF() but maybe I didn't get the syntax right. Thanks.

110001
011101
000000
111111
101010
 
=-SUMPRODUCT(-MID(R1:INDEX(R:R,COUNTA(R:R)),{1,2},1))

Assumes data is contiguous.

That almost works but the following range has a total sum of 3 instead of 5 so it looks like that only the first digit is being considered.
Also some strings commence with a 0 so there is a single speech mark to qualify the string. Is this going to confuse the formula?

Code:
111001
'011111
111111
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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