# Trying to divide a cell value by a countif value

#### mtaylor

##### New Member
Hi Team,

Weird one this. I have set my formula to this: =(countif(C3:AI3,"*")/(AJ3)*100) and it works.

However I want it the other way round: =(AJ3)/(countif(C3:AI3,"*")*100) and it comes as 0, whereas it should be 100

Tell me doing something stupid!?

Thanks

Matt

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

#### Peter_SSs

##### MrExcel MVP, Moderator
Hard to tell without knowing what is in C3:AI3 ans AJ3

#### mtaylor

##### New Member

 KG1A Name % 22/03 23/03 24/03 25/03 26/03 29/03 30/03 31/03 01/04 02/04 05/04 06/04 07/04 08/04 09/04 12/04 13/04 14/04 15/04 16/04 19/04 20/04 21/04 22/04 23/04 22/03 23/03 24/03 26/04 27/04 28/04 29/04 30/04 Days Present Total Student's name 0 L P P P P 5

This is for registers. L and P represent Late and Present.

The 5 at the end is counting how many L's and P's appear in the dates 22/03 to 30/04.

Hope this is more useful than my original post?

Matt

#### mtaylor

##### New Member
The cell with the '5' in uses the formula: =COUNTIF(\$C3:\$AI3,"P")+COUNTIF(\$C3:\$AI3,"L")

#### Peter_SSs

##### MrExcel MVP, Moderator
If you are expecting 100 as the result of the 2nd formula, then perhaps you meant this?

=AJ3/COUNTIF(C3:AI3,"*")*100

#### mtaylor

##### New Member
Amazing!!

Thank you very much!!

#### sanrv1f

##### MrExcel MVP
BTW, why use COUNTIF with *? why not COUNTA?

#### mtaylor

##### New Member
BTW, why use COUNTIF with *? why not COUNTA?
Hmmmmmm...never used counta.. Will have a gander today.

Thanks for the suggestion

#### Peter_SSs

##### MrExcel MVP, Moderator
BTW, why use COUNTIF with *? why not COUNTA?
I initially wondered if it was deliberate as they behave differently if any numerical values are in the range. Looking at post # 3 though that appears unlikely.

COUNTA may be all that is required in AJ3 as well?