Including a value in calculation only if it's a positive number

G

Guest

I have data showing balances of clients for the month - some positive, some
negative. If it's a positive number, I need to subtract it from a total. Is
there a way for Access to recognize and use only positive numbers from a
field in my formula?
 
F

fredg

I have data showing balances of clients for the month - some positive, some
negative. If it's a positive number, I need to subtract it from a total. Is
there a way for Access to recognize and use only positive numbers from a
field in my formula?

And your formula is ??????
And you are doing this where? form? report? query?
 
G

Guest

I'm doing it in a query. I've been able to come up with this--> NegTotal:
IIf([Total]<0,0). So, if my total number is negative, it'll be a zero.
However if [Total] is positive, I want it to show that number. Therefore,
when I sum the numbers, I'll only be adding the positive numbers. My
question at this point is how, or if, I can add a "then" statement to what I
have above. Does this make sense?
 
F

fredg

I'm doing it in a query. I've been able to come up with this--> NegTotal:
IIf([Total]<0,0). So, if my total number is negative, it'll be a zero.
However if [Total] is positive, I want it to show that number. Therefore,
when I sum the numbers, I'll only be adding the positive numbers. My
question at this point is how, or if, I can add a "then" statement to what I
have above. Does this make sense?

fredg said:
And your formula is ??????
And you are doing this where? form? report? query?

If you use IIf() you should enter both the true and false arguments.


Exp:IIf([Total]<0,0,[Total]).
 
J

John Vinson

Is
there a way for Access to recognize and use only positive numbers from a
field in my formula?

Sure: use a term in your calculation

IIF([field] > 0, [field], 0)

John W. Vinson[MVP]
 

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