Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default countif not working

vba excel 07
Want to count all strings that are two characters long in a range. Using
countif(range, "??") but it doesn't work.

The strings are numbers so I think that might be screwing it up. Tried
countif(range,"<100") but that didn't work either.

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default countif not working

Hi John

Look at theese examples:

Sub CountIt()
'Numbers only
Set MyRange = Range("A1:A100")
MyCount = WorksheetFunction.CountIf(MyRange, "<100") _
- WorksheetFunction.CountIf(MyRange, "<10")
Debug.Print MyCount
End Sub

Sub CountIt2()
'Numbers and text count
Dim MyRange As Range
Set MyRange = Range("A1:A100")

For Each c In MyRange.Cells
If Len(c) = 2 Then MyCount = MyCount + 1
Next
Debug.Print MyCount
End Sub

Hopes this helps.
....
Per


"John" skrev i meddelelsen
...
vba excel 07
Want to count all strings that are two characters long in a range. Using
countif(range, "??") but it doesn't work.

The strings are numbers so I think that might be screwing it up. Tried
countif(range,"<100") but that didn't work either.

John


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default countif not working

Hi,

Validation using the keys : CTRL + Maj + Enter

=Sum(if(len(Your_Range)=2;1))



"John" a écrit dans le message de groupe de discussion :
...
vba excel 07
Want to count all strings that are two characters long in a range. Using
countif(range, "??") but it doesn't work.

The strings are numbers so I think that might be screwing it up. Tried
countif(range,"<100") but that didn't work either.

John

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
Countif Range not working tommcbrny Excel Worksheet Functions 4 August 1st 08 05:29 PM
Countif not working c mateland Excel Worksheet Functions 3 September 3rd 07 02:46 AM
CountIf Array not working NWO Excel Discussion (Misc queries) 1 March 1st 07 07:48 PM
Countif, not working. Clash Excel Discussion (Misc queries) 2 July 20th 06 11:28 AM
countif not working Nick Krill Excel Discussion (Misc queries) 4 June 24th 06 07:42 PM


All times are GMT +1. The time now is 08:01 AM.

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"