ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   COUNTIF Problems (https://www.excelbanter.com/excel-discussion-misc-queries/36870-countif-problems.html)

PW11111

COUNTIF Problems
 

Hi,

I have the following formula:

=IF(ISERROR(COUNTIF(StatusCheck, "Snag Item")/COUNTIF(ElementCount,"Main
Contractor - Builderswork")),0,COUNTIF(StatusCheck, "Snag
Item")/COUNTIF(ElementCount,"Main Contractor - Builderswork"))

Originally I had some problems getting ISERROR to work properly - but this
is sorted now.

The formula is supposed to count the number of times a snagging item is
added into the spreadsheet (each snagging item has its own row) that is
assigned a status of "Snag Item" and an Element of "Main -Contractor -
Builderswork". The formula works fine for one item - but if two or more are
added the formula returns 1.

Any ideas why this is not working.?

Cheers,

Phil

Damon Longworth

What do you mean by "two or more are added"?

I am guessing you were getting an error because the formula was dividing by
zero. You could check for zero instead of duplicating the entire formula.
Not a big deal unless you have a large file with many formula.

Try:

=IF(COUNTIF(ElementCount,"Main Contractor -
Builderswork")<0,COUNTIF(StatusCheck, "Snag
Item")/COUNTIF(ElementCount,"Main Contractor - Builderswork"))


--
Damon Longworth

Don't miss out on the 2005 Excel User Conference
Sept 16th and 17th
Stockyards Hotel - Ft. Worth, Texas
www.ExcelUserConference.com


"PW11111" wrote in message
...

Hi,

I have the following formula:

=IF(ISERROR(COUNTIF(StatusCheck, "Snag Item")/COUNTIF(ElementCount,"Main
Contractor - Builderswork")),0,COUNTIF(StatusCheck, "Snag
Item")/COUNTIF(ElementCount,"Main Contractor - Builderswork"))

Originally I had some problems getting ISERROR to work properly - but this
is sorted now.

The formula is supposed to count the number of times a snagging item is
added into the spreadsheet (each snagging item has its own row) that is
assigned a status of "Snag Item" and an Element of "Main -Contractor -
Builderswork". The formula works fine for one item - but if two or more
are
added the formula returns 1.

Any ideas why this is not working.?

Cheers,

Phil





All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com