calculation based on criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get a field to calculate a certain way based on criteria. In
other words if the value of the Lite field is JD then the calculation should
be Sum([Cns].[FEE])*8*0.087 if the value is not JD then the calculation
should be Sum([Cns].[FEE])*7*0.140. Any suggestions?
This is what I put in the field line that didn't work (don't laugh it was
pure guess work!:) ):
Sum of FEEs:
IIf([Cns].[Lite]='JD',Sum([Cns].[FEE])*8*0.087,Sum([Cns].[FEE])*7*0.140)
Thanks a lot for any help!
-Jen
 
I don't have time to test this tonight (time to go), but give it a try. If
it doesn't work, post back and I can test it in the morning.

Sum([Cns].[Fee] * IIF([Cns].[LIte] = "JD", 8*0.087, 7*0.140)
 
Jennyrd said:
I am trying to get a field to calculate a certain way based on criteria.
In
other words if the value of the Lite field is JD then the calculation
should
be Sum([Cns].[FEE])*8*0.087 if the value is not JD then the calculation
should be Sum([Cns].[FEE])*7*0.140. Any suggestions?
This is what I put in the field line that didn't work (don't laugh it was
pure guess work!:) ):
Sum of FEEs:
IIf([Cns].[Lite]='JD',Sum([Cns].[FEE])*8*0.087,Sum([Cns].[FEE])*7*0.140)

Pardon me for...

if I am looking at a record in
the group I am making,

factor for that record is
IIF(Cns.Lite='JD', 8*0.087,7*0.140)

product for that record is
factor * Cns.FEE

again, want to do that for every single record
in the group

then, want to sum all those products
to produce a sum of products for all
records for that group


SUM(IIF(Cns.Lite='JD', 8*0.087,7*0.140)*Cns.FEE)
 
It works!! Thanks for your help!!
-Jenny

Klatuu said:
I don't have time to test this tonight (time to go), but give it a try. If
it doesn't work, post back and I can test it in the morning.

Sum([Cns].[Fee] * IIF([Cns].[LIte] = "JD", 8*0.087, 7*0.140)
--
Dave Hargis, Microsoft Access MVP


Jennyrd said:
I am trying to get a field to calculate a certain way based on criteria. In
other words if the value of the Lite field is JD then the calculation should
be Sum([Cns].[FEE])*8*0.087 if the value is not JD then the calculation
should be Sum([Cns].[FEE])*7*0.140. Any suggestions?
This is what I put in the field line that didn't work (don't laugh it was
pure guess work!:) ):
Sum of FEEs:
IIf([Cns].[Lite]='JD',Sum([Cns].[FEE])*8*0.087,Sum([Cns].[FEE])*7*0.140)
Thanks a lot for any help!
-Jen
 

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

Back
Top