Countif 4 digit Number starts with

blossomthe2nd

Active Member
Joined
Oct 11, 2010
Messages
450
Hi guys

I am trying to write a query that counts the number of 4 digit numbers that start with 3,

I have the text verson

=COUNTIF(A2:A7,"3???")

But this only finds 4 digits that start with 3 if it contains text ? so it will find 3ABC but not 3456 !

Can anyone help please ?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

machopicho

Well-known Member
Joined
Feb 28, 2010
Messages
606
TRY:
=IF(LEFT(A2:A7,1)="3",COUNT(A2:A7),"")
insert with CTRL + SHIFT + RETURN
 

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I would do it like this...

Excel 2003 and earlier:
Code:
=COUNTIF(A2:A7,">=3000")-COUNTIF(A2:A7,">=4000")

Excel 2007 and later:
Code:
=COUNTIFS(A2:A7,">=3000",A2:A7,"<4000")
 

blossomthe2nd

Active Member
Joined
Oct 11, 2010
Messages
450
Thanks Guys

Do you know if there is a way to just count Whole numbers ?

Or is there a way on formating to round DOWN a decimal ?

Thanks
 

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Do you know if there is a way to just count Whole numbers ?
Try either of these
Code:
=SUMPRODUCT(--(A2:A7>=3000),--(A2:A7<=4000),--(INT(A2:A7)=A2:A7))
 
=SUMPRODUCT(--(A2:A7>=3000),--(A2:A7<=4000),--(LEN(A2:A7)=4  ))

Or is there a way on formating to round DOWN a decimal ?
Why do you want to round down... do you plan to sum the numbers as well?
 
Last edited:

blossomthe2nd

Active Member
Joined
Oct 11, 2010
Messages
450
Hi Macho,

Its grand I put a second column in with

=ROUNDDOWN(A2,0) and it works perfect

Thanks for your help
 

Forum statistics

Threads
1,141,017
Messages
5,703,752
Members
421,313
Latest member
Mooncake1

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
Top