CountIf from drop down list

mlevar

New Member
Joined
Nov 21, 2008
Messages
25
I have a drop down list with 3 option, (Yes, No or DK). I am trying to count the number of times Yes appears in the column. I'm certain that I have the countif formula set up correctly. However, I am getting a value of O as a result. I get the same result if I change the Criteria to No or DK also. Is the drop down list the issue? Here is the formula:

'=COUNTIF(N2:N198,"Yes")

Thanks,

Marcelle
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
The formula looks right.

Can you copy/paste the contents of the "Source" box from Validation into the thread?
 
Upvote 0
It seems like list value may have an extra space?

Try this...
Select the "Yes" item...Click in the Formula Bar
Is there an extra space before or after "Yes"?
Code:
"Yes " versus "Yes"

Does that help?
 
Upvote 0
Sure, the name of the drop down list is =cellcomp and the contents of the source list is:

<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=64 border=0 x:str><COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 48pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=64 height=17 x:str="Yes ">Yes </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17 x:str="No ">No </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>DK</TD></TR></TBODY></TABLE>
 
Upvote 0
OK, so cellcomp is a Named Range from Inert - Name - Define ?

Check the source data for extra spaces as Ron Pointed out.
 
Upvote 0
Thanks! Adding the space to the formula worked.

Glad it works, but I must say you would be better off correcting the Data at the source, not in the formula. If you ever have to use that data for another formula or something, you may have problems because of the extra space. Just fix it at the source and be done with it.
 
Upvote 0

Forum statistics

Threads
1,223,792
Messages
6,174,612
Members
452,574
Latest member
hang_and_bang

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top