VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

E

EagleOne

2003-2007

Facts:

Range("A1").Value = "M7"
Range("B1").Value = "M9"

Challenge:
What would the syntax be to Countif(A1:B1,????) where ???? is the value of Left(A1,1) = "M"?
In short, I want to count all "M" regardless of the Number. Thus Countif(A1:B1,????) = 2


Is this possible?

TIA EagleOne
 
P

Per Jessen

Hi

If the cells always have only 2 characteres use:

=COUNTIF(A1:A5;"M?")

If the cells can have more characters, use:

=COUNTIF(A1:A5;"M*")

Regards,
Per
 
E

EagleOne

Thanks Per.

I was sure over thinking it!

Per Jessen said:
Hi

If the cells always have only 2 characteres use:

=COUNTIF(A1:A5;"M?")

If the cells can have more characters, use:

=COUNTIF(A1:A5;"M*")

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top