Count

How_Do_I

Well-known Member
Joined
Oct 23, 2009
Messages
1,838
Office Version
  1. 2010
Platform
  1. Windows
How would I do this please. I want to know how many cells in the range A1:D5 start with 28 and how many start with 57d. My Jeanie is a sample, I'm not after cells that contain 28 for example, whatever I'm trying to count must be from the left.

Excel Workbook
ABCDEFG
128.B.628.C.157d.Q.328.C.228
228.B.1228.C.757d.Q.928.C.857d
328.B.1828.C.1328.C.14
428.C.1928.C.20
528.B.3028.C.2557d.Q.2728.C.28
Sheet8
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try:
=COUNTIF(A$1:D$5,"28*")
and
=COUNTIF(A$1:D$5,"57d*")
 
Upvote 0
try

=COUNTIF($A$1:$D$5,F1&"*")

and copy down
 
Last edited:
Upvote 0
Actually I think there's a problem still. In my workbook some cells start with "36" and some with "36c". So those solutions won't deal with that will they?
 
Upvote 0
They should work just fine.
You can count all the records that start with "36".
And you can count all the records that start with "36c".
If you want a count of all the records that start with "36", but NOT include those that start with "36c", just subtract the one from the other, i.e.
=COUNTIF(A$1:D$5,"36*") - COUNTIF(A$1:D$5,"36c*")
 
Upvote 0
In case anyone else is looking for a similar solution I used the "." which appear in all my data and instead of " 28 " (Number) I used " '28. " (Text) and the following formula in G1 copied down.

Excel Workbook
ABCDEFG
128.B.628.C.157d.Q.328.C.228.13
228.B.1228.C.757d.Q.928c.C.857d.3
328.B.1828.C.1328.C.1428c.1
428.C.1928.C.20
528.B.3028.C.2557d.Q.2728.C.28
Sheet8
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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