Conditional expression help needed.

  • Thread starter Thread starter dmschulz
  • Start date Start date
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
 
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))
 
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
 
Back
Top