Summing numbers in cells with alphanumeric content

Tpid

New Member
Joined
Mar 4, 2022
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
I am doing a paired comparison analysis and have an Excel table where each cell contains one letter followed by one number. I want to sum the numbers for each unique letter. E.g. If there are 7 cells that begin with 'C', I want to sum the numbers that follow the 'C'. If there are 8 cells with the letter 'U', I want to sum the numbers in those three cells. I want the results of the sum for each unique letter, to be shown in a separate cell distinct to that letter (the yellow shaded boxes in my image below). If the data in my full table is contained in cells B5 to K14, I want the total of the 'C's to be in placed in cell B4. I want the total of the cells with 'U' to be placed in cell C5. I want the total of the next letter to be placed in cell D6, etc. (along the diagonal). I suspect I'll need to enter a separate formula into each of my target, diagonal cells ... but I am not clear on what that formula should be. I've read a little about SUMIF, but have not been able to master it so clearly am missing something. I'd be very grateful for any big brain help. Thankyou.
Screenshot (1).png
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Adjust the ranges and references as required and try

T202203.xlsm
ABC
1ConfidenceUnderstanding
2126
3C2C2
4D3D3
5C3C3
6C7C7
7U2U2
8U4U4
9
2a
Cell Formulas
RangeFormula
B2:C2B2=SUMPRODUCT(--(LEFT(B3:B8)=LEFT(B1,1)),--(RIGHT(B3:B8,1)))
 
Upvote 0
Adjust the ranges and references as required and try

T202203.xlsm
ABC
1Confidence
212
3C2
4D3
5C3
6C7
2a
Cell Formulas
RangeFormula
C2C2=SUMPRODUCT(--(LEFT(B3:B6)=LEFT(C1,1)),--(RIGHT(B3:B6,1)))


N.B. You can post an extract of your sheet with the forum's tool called XL2BB.
Dave, thank you for the super speedy reply. Forgive my inexperience ... in the sample formula you shared, what do the various parameters mean? SUMPRODUCT I get ... but what do the LEFT ... LEFT ... RIGHT ... parameters mean?
 
Upvote 0
N.B. You can paste my post into a clean sheet.
Click on the icon below the F(x) in the heading of the example and then move to your sheet and paste into cell A1

Left and Right are Excel functions see Excel's help for complete information.
LEFT(B1,1) finds the first letter in the word located in cell B1

Try using Excel's Formula Evaluate to review the details of the calculation.

The double negative -- coerces the results to numeric.
 
Last edited:
Upvote 0
Hi,

Please consider providing sample using XL2BB (see my signature), or at least in Table format, so helpers don't have to manually type your data for testing.

C5 formula can be copied pasted up to K13.

Book3.xlsx
ABCDEFGHIJKL
3CoUnAcVaStExLeGeBuFiRe
4Co18
5UnU320
6AcC2A121
7VaC3U3A31
8StC2U2A2S35
9ExC3U3A3E203
10Le0U1A2L20L38
11GeG10A2G3G2G3G219
12BuC3U3A3V1S10L1G31
13FiC3U3A3F1S1E1L2G3B11
14ReC2U2A2R2R2R2R2G2R1R110
Sheet1032
Cell Formulas
RangeFormula
B4B4=SUMPRODUCT((LEFT(B5:B$14)=LEFT($A4))*RIGHT(B5:B$14))
C5,K13,J12,I11,H10,G9,F8,E7,D6C5=SUMPRODUCT((LEFT(C6:C$14)=LEFT($A5))*RIGHT(C6:C$14))+SUMPRODUCT((LEFT($B5:B5)=LEFT($A5))*RIGHT($B5:B5))
L14L14=SUMPRODUCT((LEFT($B14:K14)=LEFT($A14))*RIGHT($B14:K14))
 
Upvote 0
Solution
N.B. You can paste my post into a clean sheet.
Click on the icon below the F(x) in the heading of the example and then move to your sheet and paste into cell A1

Left and Right are Excel functions see Excel's help for complete information.
LEFT(B1,1) finds the first letter in the word located in cell B1

Try using Excel's Formula Evaluate to review the details of the calculation.

The double negative -- coerces the results to numeric.
Thank you Dave. I appreciate the great information!
 
Upvote 0
Hi,

Please consider providing sample using XL2BB (see my signature), or at least in Table format, so helpers don't have to manually type your data for testing.

C5 formula can be copied pasted up to K13.

Book3.xlsx
ABCDEFGHIJKL
3CoUnAcVaStExLeGeBuFiRe
4Co18
5UnU320
6AcC2A121
7VaC3U3A31
8StC2U2A2S35
9ExC3U3A3E203
10Le0U1A2L20L38
11GeG10A2G3G2G3G219
12BuC3U3A3V1S10L1G31
13FiC3U3A3F1S1E1L2G3B11
14ReC2U2A2R2R2R2R2G2R1R110
Sheet1032
Cell Formulas
RangeFormula
B4B4=SUMPRODUCT((LEFT(B5:B$14)=LEFT($A4))*RIGHT(B5:B$14))
C5,K13,J12,I11,H10,G9,F8,E7,D6C5=SUMPRODUCT((LEFT(C6:C$14)=LEFT($A5))*RIGHT(C6:C$14))+SUMPRODUCT((LEFT($B5:B5)=LEFT($A5))*RIGHT($B5:B5))
L14L14=SUMPRODUCT((LEFT($B14:K14)=LEFT($A14))*RIGHT($B14:K14))
Thank you so very much! This was my first time posting a question, and I now understand why just including an 'image' of my table, rather than attaching a mini-sheet was not a smart thing to do. I sincerely appreciate your help. :)
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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