Counting Individual Numbers Within Cells

rkoehler58

New Member
Joined
Sep 18, 2014
Messages
22
I have a sheet which contains the following:

Column A Column B Column C Column D
Safe 4, 10 Hot 3
Safe 1, 3, 5 Hot 2, 5
Safe 13 Hot 7

Columns B and D may contain multiple entries within a cell.

I am trying to develop a formula to calculate the total number of entries for "Safe and "Hot".

In my example, the number of entries for "Safe" will be 6, while the number of entries for "Hot" would be 4.

Can anyone suggest a way to do this?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
rkoehler,

If the entries will always be separated by a comma then maybe something like.....

Excel 2007
ABCDEF
1SafeHot
2Safe4, 10Hot397
3Safe1,3, 5Hot2, 5
4Safe13Hot7
5Safe1, 2, 3Hot1, 2, 3
6
Sheet6
Cell Formulas
RangeFormula
E2{=SUM(LEN(B2:B20)-LEN(SUBSTITUTE(B2:B20,",",""))+IF(B2:B20="",0,1))}
F2{=SUM(LEN(D2:D20)-LEN(SUBSTITUTE(D2:D20,",",""))+IF(D2:D20="",0,1))}
Press CTRL+SHIFT+ENTER to enter array formulas.

Hope that helps.
 
Last edited:
Upvote 0
rkoehler,

If the entries will always be separated by a comma then maybe something like.....
Excel 2007
ABCDEF
1SafeHot
2Safe4, 10Hot397
3Safe1,3, 5Hot2, 5
4Safe13Hot7
5Safe1, 2, 3Hot1, 2, 3
6

<colgroup><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet6

Array Formulas
CellFormula
E2{=SUM(LEN(B2:B20)-LEN(SUBSTITUTE(B2:B20,",",""))+IF(B2:B20="",0,1))}
F2{=SUM(LEN(D2:D20)-LEN(SUBSTITUTE(D2:D20,",",""))+IF(D2:D20="",0,1))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>


Hope that helps.

That works great. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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