If Statement Issue

creyn

Board Regular
Joined
Sep 16, 2016
Messages
127
Below is the query I am working on. I am having an issue with my IIF Statement. Please tell me what I am doing wrong? I am trying to get the query to place a "DQIP" in the Deviations_Request.Information field if the Deviations_Request.Nonadoptcomment = "Taiwan is non GC country, DQIP is not in scope for Taiwan".

SELECT Deviations_Request.AppId,
Deviations_Request.AppName,
Deviations_Request.Datastdname,
Deviations_Request.Devreqsubmitted,
Deviations_Request.Nonadoptcomment,
Deviations_Request.Nonadoptreasondesc,
Deviations_Request.[Final OA Comment],
IIF(Deviations_Request.Nonadoptcomment = "Taiwan is non GC country, DQIP is not in scope for Taiwan", Deviations_Request.Information = "DQIP", "") As Information_Column
FROM Deviations_Request
GROUP BY Deviations_Request.AppId, Deviations_Request.AppName, Deviations_Request.Datastdname, Deviations_Request.Devreqsubmitted, Deviations_Request.Nonadoptcomment, Deviations_Request.Nonadoptreasondesc, Deviations_Request.[Final OA Comment], Deviations_Request.Information;
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I figured it out:

SELECT Deviations_Request.AppId,
Deviations_Request.AppName,
Deviations_Request.Datastdname,
Deviations_Request.Devreqsubmitted,
Deviations_Request.Nonadoptcomment,
Deviations_Request.Nonadoptreasondesc,
Deviations_Request.[Final OA Comment],
IIF([Deviations_Request.Nonadoptcomment] = "Taiwan is non GC country, DQIP is not in scope for Taiwan" Or [Deviations_Request.Nonadoptcomment] = "India is not GC and DQIP is not in scope as of now", "DQIP", "") As Information_Column
FROM Deviations_Request
GROUP BY Deviations_Request.AppId, Deviations_Request.AppName, Deviations_Request.Datastdname, Deviations_Request.Devreqsubmitted, Deviations_Request.Nonadoptcomment, Deviations_Request.Nonadoptreasondesc, Deviations_Request.[Final OA Comment], Deviations_Request.Information;
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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