IIF Expression with Multiple Conditions

mba_110

Board Regular
Joined
Nov 28, 2012
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Dear All,

I am trying to make following expression in access i succeeded in excel but unable to get correct result in Access 2010 query.

Can anyone help me please?

My excel formulas was
=IF(ISNUMBER(AB13),IF(G13="Egyptian",AB13*1800)+IF(G13="Philippines",AB13*3500)+IF(G13="Sudan",AB13*2000)+IF(G13="Nepal",AB13*2500)+IF(G13="Indonesia",AB13*2500)+IF(G13="Bangladesh",AB13*2500)+IF(G13="Indian",AB13*2500)+IF(G13="Pakistan",AB13*2500),ROUND(,0))


My access attempt is
Approx_Amt: IIf(IsNumeric([Accrued_Tkt]),IIf([Employees]![Nationality]="Egypt",[Accrued_Tkt]*1800)+IIf([Employees]![Nationality]="India",[Accrued_Tkt]*2500)+IIf([Employees]![Nationality]="Sudan",[Accrued_Tkt]*2000)+IIf([Employees]![Nationality]="Nepal",[Accrued_Tkt]*2500)+IIf([Employees]![Nationality]="Indonesia",[Accrued_Tkt]*2500)+IIf([Employees]![Nationality]="Bangladesh",[Accrued_Tkt]*2000)+IIf([Employees]![Nationality]="Morocco",[Accrued_Tkt]*2500)+IIf([Employees]![Nationality]="Pakistan",[Accrued_Tkt]*2500)+IIf([Employees]![Nationality]="Philippines",[Accrued_Tkt]*3500),Round(,0))


thanks & regards,

MBA
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Rather than use an IIF statement create another table to hold the nationality and multiplier.

As a simplified example - if you have two tables. The first table, called Employees, contains the Nationality and Accrued_Tkt amount. The second table, called LookUp, contains the nationality and multiplier amount.

This SQL will multiply the Employees.Accrued_Tkt by the LookUp.Multiplier:
Rich (BB code):
SELECT  Employees.Nationality, Accrued_Tkt, Accrued_Tk*Multiplier
FROM    Employees LEFT JOIN Lookup ON Employees.Nationality = Lookup.Nationality
Excel Workbook
ABC
1Employees**
2NationalityAccrued_Tkt*
3India1*
4Sudan2*
5Egypt3*
6***
7LookUp**
8NationalityMultiplier*
9Egypt1800*
10India2500*
11Sudan2000*
12***
13Query1**
14NationalityAccrued_TktExpr1
15India12500
16Sudan24000
17Egypt35400
Sheet
 
Last edited:
Upvote 0
Dear Darren,

Many thanks for your help.

However i dont like so many tables and queries in my first project database at early stages because there will be many as far as i move forward, hence i have made only one table called lookup with Nationality and multiplier amount as you mentioned.

Actually let me explain you a little i am trying to calculate [Approx_Amt] amount of [Contract]![Ticket] based on their [Accrued_Tkt] numbers, but as per their [Employees]![Nationality]'s price.

Please i have following tables which contains the field that i need to get result from.

Tables Field
Contract [Ticket]
Employees [Nationality]

Query Field
AirticketQuery [Accrued_Tkt]
[Approx_Amt] - This is result field.

As per your advise i have created lookup table this will help me in this expression as well as any other future requirement that need to be listed, but please can you provide me the code based on above or expression that i original asked for?

thanks & regards,

MBA
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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