Report Builder function - IIF nesting

yomero

Active Member
Joined
May 14, 2008
Messages
257
Please some help with these formula.

In a query I want to consolidate the values of multiple columns into a new column

My new column = UniqueID
Existing columns:
MDN
UUID
IMSI
IMEI
ICCID

Populate UNIQUEID column logic:
- If MDN ="NA" then UUID
- If UUID = "NA" then IMSI​
- If IMSI = "NA" OR is Null then IMEI​
- If IMEI is null then ICCID

I have been successful at populating nesting only 2:
UniqueID: IIf([msisdn]="NA",IIf([UUID]<>"NA",[UUID],[imsi]))
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
If I were doing this I would use a User Defined Function (UDF) in a VBA code module.

This would also allow you to reused ti in other places as needed. Depending on how you would reused it, you could pass only the primary key for the record. You may need to pass all 5 values. The Global function would return the desired value. This also makes maintaining the logic very easy since it is only in one place.
 
Upvote 0
I figured it out, posting the solution to help others with the same question.

UniqueID: IIf([msisdn]="NA",IIf([UUID]<>"NA",[UUID],IIf([imsi] Is Not Null,[imsi],IIf([iccid] Is Not Null,[iccid],[imeisv]))),[msisdn])
 
Upvote 0
FYI as long as imeisv and msisdn cannot ever be null, you should be OK, otherwise I think your expression will fail. You also have to be OK with the expression returning either msisdn or imeisv if the others are null.
 
Upvote 0

Forum statistics

Threads
1,221,844
Messages
6,162,346
Members
451,760
Latest member
samue Thon Ajaladin

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