Help with an IIf funcition

Pettor

Board Regular
Joined
Aug 8, 2015
Messages
175
Hello guys,

Can someone give me a help with the function below?

Everything breaks when I am trying to enter the IIf after the minus symbol

VBA Code:
IIf([FieldName]=0,0,Nz(Sum(IIf([Table1].[Column1]="10" OR [Table1].[Column1]="20",”50”,”30”)))-IIf(ISNULL([Table1].[Column2]),0,SUM(IIf(ISNULL([Table1].[Column2]),0,1)))) AS TEST,

Basically, the question is, can I place an Iff function inside another IIf function?

Thanks
 
Last edited:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
What I get as a reply is that "the query doesn't include the specified expression as part of an aggregate function"
 
Upvote 0
can I place an Iff function inside another IIf function?
Yes, you can, but I do see a few other issues with your formula.

1. If you are checking for numeric values, they should NOT be inside of double-quotes. Double-quotes indicate Text/string values. Unless those are numbers entered as Text, it should probably look like:
IIf([Table1].[Column1]=10

2. Access does not like slanted double-quotes (there is a difference.
" is OK
” is NOT OK

There may be other issues too, but those two stick out.
 
Upvote 0
My advice when building complicated formulas is not to try to do it all at once. Start with a simplistic piece of it. Once you get that working, add another piece to it.
Once you get that working, then add the next layer of complexity to it.
So you are building it, bit-by-bit, and you can see where things get off track.
 
Upvote 0
OK. If you need help with this, we would probably need to see a samle of what the data table looks like, and the SQL code for the entire query, as it appears you are doing an Aggregate Query, so it is important to see how the rest of the query is written.
 
Upvote 0

Forum statistics

Threads
1,214,395
Messages
6,119,265
Members
448,881
Latest member
Faxgirl

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