Help with IIF Statement in a Query

Woelfe

New Member
Joined
Sep 17, 2002
Messages
35
Hello! I am hoping to get some help with an expression I am trying to write in an Access query. I have managed to create an expression called Cumulative that adds two other fields together. The new expression I am having trouble writing is to evaluate the amount in Cumulative and return either a True or False answer based on the IIF function.

What I have written is:

IIf ([Cumulative] > «Expr» = «Expr» "3772", [Cumulative] * «Expr» "0.0106065", "40")

Basically, if Cumulative is greater than or equal to 3772 I want it to take Cumulative and multiply it by by 0.010605, otherwise just show 40.

I built this using the Expression Builder, but when I try to run the query I get an error: The expression you entered contains invalid syntax - you may have entered an operand without an operator.

I am very new to building expressions so any suggestions are greatly appreciated.

Thank you in advance...
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Remove each instance of this from the expression.
Code:
<<Expr>>

I would also suggest you remove the quotes from the numbers.
 
Upvote 0
Remove each instance of this from the expression.

I would also suggest you remove the quotes from the numbers.

Norie, thank you so much! The <<Expr>> was dropped in while using the builder automatically. Originally I didn't have the quotes on the numbers, but then thought maybe I should. It worked perfectly now.
 
Upvote 0
Woelfe

No problem.

It's sometimes useful for the builder to include that - it can help remind you what arguments are needed.

But it can be annoying sometimes.:)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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