Conditional expression help needed.

D

dmschulz

I am trying to write an expression for a report. It needs to count only yes
answers for a field and ignore all other answers. I know this should be easy
and I've searched the help files for 2 days now. All I have learned has been
self taught. If anyone can be of assistance I'd greatly appreciate it.
Thanks in advance,
Dawn
 
D

Douglas J. Steele

Assuming you're talking about a Boolean field (which Access misnames Yes/No
field), try

=Sum(IIf([NameOfField], 1, 0))

If you're actually talking about a text field that contains the letter Y,
try

=Sum(IIf([NameOfField] = "Y", 1, 0))
 
D

dmschulz

Thank you so much Doug. It worked perfectly.

Dawn

Douglas J. Steele said:
Assuming you're talking about a Boolean field (which Access misnames Yes/No
field), try

=Sum(IIf([NameOfField], 1, 0))

If you're actually talking about a text field that contains the letter Y,
try

=Sum(IIf([NameOfField] = "Y", 1, 0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


dmschulz said:
I am trying to write an expression for a report. It needs to count only yes
answers for a field and ignore all other answers. I know this should be
easy
and I've searched the help files for 2 days now. All I have learned has
been
self taught. If anyone can be of assistance I'd greatly appreciate it.
Thanks in advance,
Dawn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top