Summing Results of Iif Statements

G

Guest

I am trying to sum the results of an Iif statement and not getting the
results that I want.

I have 12 Iif statements - one for each month that look like
=IIf([ProjResMonth]=3,FormatNumber([ProjResHours]),'') - this one's for
March

This works fine and returns the number of hours only for that month.
However, I want to them sum the number of hours for that one month in a
footer. So, I gave the above field the label "MarHours" and added a new Text
Box with the logic

= Sum([MarHours])

However, when I run the report, it prompts me for MarHours like the field
doesn't exist.

I have tried converting the results of the Iif statement to a number using
the FormatNumber command thinking the results were considered text but that
didn't fix the problem.

Any ideas? Thanks!
 
J

John Spencer

You have to sum the formula not the name of the formula. Also if you format
something, it becomes a text string. Try the following formula

=SUM(IIF(ProjResMonth=3,ProjResHours,NULL))
 

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