Adding iif statements In calculated Field

mrmarc

Board Regular
Joined
Feb 3, 2014
Messages
79
Having some problems with a calculated field.

In my head this should work:

IIf([Grade] Like "*SS1*",[NumberOfCases]*28,0) Or IIf([Grade] Like "*SS2*",[NumberOfCases]*28,0) Or IIf([Grade] Like "*11P*",[NumberOfCases]*28,0) Or IIf([Grade] Like "*11S*",[NumberOfCases]*28,0)

I am getting results like "-1", but basically I need a formula that will multiply the "NumberOfCases" if it is a specific "Grade".

Thots?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I suggest to put the formula in the data source as a helper column instead, then use that helper column in the pivot table.


Having some problems with a calculated field.

In my head this should work:

IIf([Grade] Like "*SS1*",[NumberOfCases]*28,0) Or IIf([Grade] Like "*SS2*",[NumberOfCases]*28,0) Or IIf([Grade] Like "*11P*",[NumberOfCases]*28,0) Or IIf([Grade] Like "*11S*",[NumberOfCases]*28,0)

I am getting results like "-1", but basically I need a formula that will multiply the "NumberOfCases" if it is a specific "Grade".

Thots?
 
Upvote 0
Try the following as I believe your syntax is incorrect:

IIf([Grade] Like "*SS1*" Or [Grade] Like "*SS2*"Or [Grade] Like "*11P*" Or [Grade] Like "*11S*",[NumberOfCases]*28,0)
 
Upvote 0
Try the following as I believe your syntax is incorrect:

IIf([Grade] Like "*SS1*" Or [Grade] Like "*SS2*"Or [Grade] Like "*11P*" Or [Grade] Like "*11S*",[NumberOfCases]*28,0)

Thanks alan! that works.

Now what if I wanted to add a statement with another "true" result. So somehting like:
IIf([Grade] Like "*SS1*" Or [Grade] Like "*SS2*"Or [Grade] Like "*11P*" Or [Grade] Like "*11S*",[NumberOfCases]*28,0) And IIf([Grade] Like "*T1Costco*" Or [Grade] Like "*T2Costco*",[NumberOfCases]*27,0)

This is not working for me.
 
Upvote 0
i'm not understanding what you want from the expression you have show. Suggest you write out in simple English what your criteria is so that someone can convert your criteria to an expression that will work in Access.
 
Upvote 0
thanks for the help guys.
maybe you can help my with this one:

I have created my own search popup form for a query. The query is in a subform on "form1" in a navigation form. I have coded the tab for "form1" to fire the search popup. It works, but my problem is that the "Enter Value Parameter" popup for the query is also firing. So I end up with first the "Enter Value Parameter" with "Forms!frmSearchGrowerPounds!cmbGrowers" firing and then my customized search popup form firing, so two pop ups.

I want to suppress the: "Enter Value Parameter" with "Forms!frmSearchGrowerPounds!cmbGrowers" so that only my customized search popup fires.

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,221,893
Messages
6,162,659
Members
451,780
Latest member
Blake86

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