Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

Ignore my reference to VBA as I need a w/s formula

wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

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

skrev i meddelelsen
...
Ignore my reference to VBA as I need a w/s formula

wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

Try this formula...

=COUNTIF(A1:A100,"M*")

--
Rick (MVP - Excel)


wrote in message
...
Ignore my reference to VBA as I need a w/s formula

wrote:

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

Thanks Rick.

I was sure over thinking it!

"Rick Rothstein" wrote:

Try this formula...

=COUNTIF(A1:A100,"M*")



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default VBA Syntax for Countif condition where only 1st char in Range of each cell = "M"

Thanks Per.

I was sure over thinking it!

"Per Jessen" wrote:

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

skrev i meddelelsen
.. .
Ignore my reference to VBA as I need a w/s formula

wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to write formula for countif (range,"<2" &"3") Vinod Tripathi Excel Discussion (Misc queries) 1 May 1st 09 07:27 AM
correct syntax for nesting "if", "and", and "vlookup"....if possib Christine Excel Worksheet Functions 4 January 2nd 09 10:43 PM
row by row comparison using a "countif" and "and" condition? controlfreak Excel Programming 2 May 16th 08 02:10 PM
What is the syntax for using the "IF" condition with an autofilte. peter147 Excel Discussion (Misc queries) 1 May 27th 06 10:19 PM
what is syntax for if(between range of dates,"Q1","Q2")? TLB Excel Worksheet Functions 3 December 6th 05 05:19 PM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"