Returning maximum of 2 values

W

William McNeill

I have a field in a query that multiplies 2 other fields and returns the
answer. It looks like this in design mode:

Freight: [Miles]*[Freight Per Mile]

This gives me the freight that I charge my customers. I have to charge a
minimum of 400, and I would like for the answer returned in the freight field
above to be either the calculation above, or 400, whichever answer is highest.

Being used to Excel I tried: Freight: MAXA([Miles]*[Freight Per Mile],400)
thinking that might work. No good. Please help. Thanks!!!!!
 
J

John Spencer

Freight: IIF([Miles]*[Freight Per Mile]>400,[Miles]*[Freight Per Mile],400)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
G

golfinray

One thing that might work is
IIF(([miles]*[freight per mile])>400, "yes","no")
Then you would either have to figure out what you want as the answers or
figure out what to do with your yes' and nos.
 

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