Using WHERE, OR and IIF with UPDATE

hemant86

New Member
Joined
Feb 10, 2015
Messages
32
Hi All I have the following table (sample)

HOST Function SWC Consumption RTB/CTB for TM1
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD SWC?
HTS ITO NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?
HTS SWD NON SWC?

<tbody>
</tbody><colgroup><col><col><col><col><col></colgroup>

I want to replicate the below excel formula in a query to populate data in column RTB/CTB for TM1

=IF(AD11="HTS SWD",IF(LEFT(E11,3)="Run","Run the Bank - Non-Regulatory",IF(C11="SWC","Change the Bank - Group Sys core code","Change the Bank - Regional Systems")),E11)

Note:AD11 - HOST Function, C11- SWC Consumption

Thanks in Advance..
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
The syntax in a query is very similar - IF changes to IIF and the cell address changes to the Field name. In your example you don't say what field E11 would equate to.


Code:
MyField:IIF([Host Function]="HTS SWD",IIF(LEFT([E11 Field],3)="Run","Run the Bank - Non-Regulatory",IIF([SWC Consumption] ="SWC","Change the Bank - Group Sys core code","Change the Bank - Regional Systems")),[E11 Field])

Also if you have multiple tables in the query and the field names being used exist in more than one then you need to include that in the field name: [Table name].[Field Name]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,582
Members
449,089
Latest member
Motoracer88

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