Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
raigo
 
Posts: n/a
Default COUNTIF function bug?

Hello, i am having trouble with the countif function. I need to count the
cells which begin with a certain numeric phrase. For example, i want excel to
count cells that start with "13". Then i would enter the following code:
=COUNTIF(A1:A10;"13*"), but it doesn`t work. It works fine with words but
gets in trouble when cells contain numbers. Is it a bug or is there something
wrong with the formula?

Example:
213
1345
13,34
13.44
1413

It should count cells 2, 3 and 4 because they start with 13. The answer
should be 3...

Thank You,
Raigo Tingas
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default COUNTIF function bug?

In a helper column enter:

=(LEFT(A1,2)="13")*1
and use countif on this column "=1"
--
Gary's Student


"raigo" wrote:

Hello, i am having trouble with the countif function. I need to count the
cells which begin with a certain numeric phrase. For example, i want excel to
count cells that start with "13". Then i would enter the following code:
=COUNTIF(A1:A10;"13*"), but it doesn`t work. It works fine with words but
gets in trouble when cells contain numbers. Is it a bug or is there something
wrong with the formula?

Example:
213
1345
13,34
13.44
1413

It should count cells 2, 3 and 4 because they start with 13. The answer
should be 3...

Thank You,
Raigo Tingas

  #3   Report Post  
Posted to microsoft.public.excel.misc
Biff
 
Posts: n/a
Default COUNTIF function bug?

Hi!

Try this:

=SUMPRODUCT(--(LEFT(A1:A6,2)="13"))

Wildcards can only be used on TEXT.

Biff

"raigo" wrote in message
...
Hello, i am having trouble with the countif function. I need to count the
cells which begin with a certain numeric phrase. For example, i want excel
to
count cells that start with "13". Then i would enter the following code:
=COUNTIF(A1:A10;"13*"), but it doesn`t work. It works fine with words but
gets in trouble when cells contain numbers. Is it a bug or is there
something
wrong with the formula?

Example:
213
1345
13,34
13.44
1413

It should count cells 2, 3 and 4 because they start with 13. The answer
should be 3...

Thank You,
Raigo Tingas



  #4   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default COUNTIF function bug?

Since numbers are stored in binary, 13.25 will not get counted in your
COUNTIF formula.
Gary has one answer, here's another
EITHER format the range as text before entering the values and use COUNTIF
OR in helper column use =TEXT(a1,"0"), copy down column and use COUNTIF on
theses values
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Gary''s Student" wrote in message
...
In a helper column enter:

=(LEFT(A1,2)="13")*1
and use countif on this column "=1"
--
Gary's Student


"raigo" wrote:

Hello, i am having trouble with the countif function. I need to count the
cells which begin with a certain numeric phrase. For example, i want
excel to
count cells that start with "13". Then i would enter the following code:
=COUNTIF(A1:A10;"13*"), but it doesn`t work. It works fine with words but
gets in trouble when cells contain numbers. Is it a bug or is there
something
wrong with the formula?

Example:
213
1345
13,34
13.44
1413

It should count cells 2, 3 and 4 because they start with 13. The answer
should be 3...

Thank You,
Raigo Tingas



  #5   Report Post  
Posted to microsoft.public.excel.misc
raigo
 
Posts: n/a
Default COUNTIF function bug?

Thank you all for your replies, unfortunately i still cant get it to work :(
It gives me a zero on all of these 3 options. For example:
=SUMPRODUCT(--(LEFT(H2:H1062;2)="17*")) gives a zero. I had to replace ","
with ";" as the formula was incorrect if there was ","
Any more ideas?

Thank You


  #6   Report Post  
Posted to microsoft.public.excel.misc
Biff
 
Posts: n/a
Default COUNTIF function bug?

=SUMPRODUCT(--(LEFT(H2:H1062;2)="17*"))

Don't use the wildcard!

=SUMPRODUCT(--(LEFT(H2:H1062;2)="17"))

Biff

"raigo" wrote in message
...
Thank you all for your replies, unfortunately i still cant get it to work
:(
It gives me a zero on all of these 3 options. For example:
=SUMPRODUCT(--(LEFT(H2:H1062;2)="17*")) gives a zero. I had to replace ","
with ";" as the formula was incorrect if there was ","
Any more ideas?

Thank You



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
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
CountIf Function Question Josh in Indy Excel Discussion (Misc queries) 4 April 6th 06 08:28 PM
CountIF Function On Linked Spreadsheet Josh in Indy Excel Discussion (Misc queries) 0 April 5th 06 05:09 PM
can you use countif function for noncontiguous cells rutledbr Excel Worksheet Functions 2 November 13th 05 09:15 PM
Excel option to store trendline's coefficients in cells for use Miguel Saldana Charts and Charting in Excel 9 June 20th 05 08:45 PM


All times are GMT +1. The time now is 09:57 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"