Syntax for combining COUNTIF and MID functions in Excel

Can any of you advise me on the correct syntax for using the COUNTIF and MID functions in Excel at the same time. My current attempt is as follows:

=COUNTIF(MID(A1:A6,1,1),"1") 

I am trying to count the number of lines in a list with integer 1 as the first character.

Any help offered is appreciated.

Thank you in advance

Jared.

+4
source share
1 answer

try it

 =COUNTIF(A1:A6,"1*") 

or if you are using excel 2007 or later

 =COUNTIFS(A1:A6,"1*") 

Note that this will match strings, but not numbers

Update:

for counting lines starting with integers> 1 try

 =COUNTIFS(A1:A6,"2*")+COUNTIFS(A1:A6,"3*")+COUNTIFS(A1:A6,"4*")+COUNTIFS(A1:A6,"5*")+COUNTIFS(A1:A6,"6*")+COUNTIFS(A1:A6,"7*")+COUNTIFS(A1:A6,"8*")+COUNTIFS(A1:A6,"9*") 

A bit clumsy, I know, but all I can think of now

+3
source

Source: https://habr.com/ru/post/1432443/


All Articles