Using WHERE, OR and IIF with UPDATE

hemant86

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

[TABLE="width: 405"]
<tbody>[TR]
[TD]HOST Function[/TD]
[TD] [/TD]
[TD]SWC Consumption[/TD]
[TD] [/TD]
[TD]RTB/CTB for TM1[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS ITO[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]HTS SWD[/TD]
[TD] [/TD]
[TD]NON SWC[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]

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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
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,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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