If based caluculation

lloyd2002

New Member
Joined
Feb 8, 2016
Messages
11
Hi All,

Trying to see if I can add an IF based calculation into my query - so depending on the value in Field1, then take the date in Field2 and add 30 days.

Any thoughts on how to write this?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
In Access, you would use an Immediate If statement. See: MS Access: iif Function
If you need help in writing it, please provide more details.
 
Upvote 0
Thanks Joe,

This what I have as a start

IIf([Point of Invoice]="entry to bodybuilder",Sum([DA - Gate rel# date]+30),0)

so If the field "Point of Invoice" has the comment "entry to bodybuilder", then I want it to display the value from field "DA - Gate rel# date" and add a further 30 days to it.

Appears to be simple enough, expect I'm now getting an error message that sates my execute query dosen't include the specified expression "Vehicle Number" as part of an aggregate function. Why does this field need to be included?
 
Upvote 0
Why are you including the SUM function on the date? That part doesn't seem to make much sense to me.
I think you just want:
Code:
[COLOR=#333333]IIf([Point of Invoice]="entry to bodybuilder",[DA - Gate rel# date]+30,0)[/COLOR]
(assuming your date field is of Date data type and not String/Text)
 
Upvote 0
You are welcome.

You would only use SUM in an Aggregate Query, and you would typically only sum number fields (it usually doesn't make sense to sum date fields).
 
Upvote 0

Forum statistics

Threads
1,221,825
Messages
6,162,190
Members
451,752
Latest member
majbizzaki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top