Advanced array function / Nested IF help required

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows
Based ob below 5 criteria, I want the output in Column G i.e. in Column "Final Comment"


[TABLE="width: 1120"]
<colgroup><col style="width:120pt" span="7" width="160"> </colgroup><tbody>[TR]
[TD="class: xl69, width: 160"]Qualifying EU LDD
[/TD]
[TD="class: xl66, width: 160"]Migration date/(Allocated date)[/TD]
[TD="class: xl67, width: 160"]KYC Next Renewal Date[/TD]
[TD="class: xl69, width: 160"]Date Equivalency Required By[/TD]
[TD="class: xl68, width: 160"]KYC Risk Rating[/TD]
[TD="class: xl68, width: 160"]CLE PEP?[/TD]
[TD="class: xl70, width: 160"]Final Comment[/TD]
[/TR]
[TR]
[TD="class: xl71"]Yes[/TD]
[TD="class: xl72"]1-Mar-20[/TD]
[TD="class: xl72"]5-Jul-19[/TD]
[TD="class: xl72"]1-Oct-19[/TD]
[TD="class: xl71"]Low[/TD]
[TD="class: xl71"]PEP [/TD]
[TD="class: xl73"] [/TD]
[/TR]
[TR]
[TD="class: xl71"]No[/TD]
[TD="class: xl72"]12-Feb-19[/TD]
[TD="class: xl72"]1-Jan-19[/TD]
[TD="class: xl72"]12-Sep-18[/TD]
[TD="class: xl71"]High[/TD]
[TD="class: xl71"]No[/TD]
[TD="class: xl73"] [/TD]
[/TR]
[TR]
[TD="class: xl71"]No[/TD]
[TD="class: xl72"]18-Jun-18[/TD]
[TD="class: xl72"]1-Jan-17[/TD]
[TD="class: xl72"]18-Jan-18[/TD]
[TD="class: xl71"]High[/TD]
[TD="class: xl71"]No[/TD]
[TD="class: xl73"] [/TD]
[/TR]
[TR]
[TD="class: xl71"]No[/TD]
[TD="class: xl72"]14-Nov-19[/TD]
[TD="class: xl72"]3-Jun-20[/TD]
[TD="class: xl72"]14-Jun-19[/TD]
[TD="class: xl71"]High[/TD]
[TD="class: xl71"]No[/TD]
[TD="class: xl73"] [/TD]
[/TR]
[TR]
[TD="class: xl71"]No[/TD]
[TD="class: xl72"]3-Jun-20[/TD]
[TD="class: xl72"]18-Jun-18[/TD]
[TD="class: xl72"]3-Jan-20[/TD]
[TD="class: xl71"]Low[/TD]
[TD="class: xl71"]PEP [/TD]
[TD="class: xl73"] [/TD]
[/TR]
</tbody>[/TABLE]




[TABLE="width: 366"]
<colgroup></colgroup><tbody>[TR]
[TD]Criteria 1
[/TD]
[/TR]
[TR]
[TD]If Qualifying EU LDD = YES
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]KYC Risk Rating = Low or Medium
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]CLE PEP = No
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]KYC Next Renewal date>=Today
[/TD]
[/TR]
[TR]
[TD]THEN "Ready To Migrate"
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[/TR]
[TR]
[TD]OR
[/TD]
[/TR]
[TR]
[TD]Criteria 2
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[/TR]
[TR]
[TD]If Qualifying EU LDD = No
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]Date Equivalency Required By > KYC Next Renewal date
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]KYC Risk Rating = Low or Medium
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]CLE PEP = No
[/TD]
[/TR]
[TR]
[TD]THEN "2 update to UK standard required at next schedule renewal"
[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD]
[/TD]
[/TR]
[TR]
[TD]OR
[/TD]
[/TR]
[TR]
[TD]Criteria 3
[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD]If Qualifying EU LDD = No
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]Date Equivalency Required By < KYC Next Renewal date
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]KYC Risk Rating = Low or Medium
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]CLE PEP = No
[/TD]
[/TR]
[TR]
[TD]THEN "3 update to UK standard required - remediation"
[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD]OR
[/TD]
[/TR]
[TR]
[TD]Criteria 4
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[/TR]
[TR]
[TD]If Qualifying EU LDD = Yes or No
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]Date Equivalency Required By > KYC Next Renewal date
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]KYC Risk Rating = High
[/TD]
[/TR]
[TR]
[TD]OR
[/TD]
[/TR]
[TR]
[TD]CLE PEP = PEP
[/TD]
[/TR]
[TR]
[TD]THEN "4 update to target location scheduled renewal"
[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD]OR
[/TD]
[/TR]
[TR]
[TD]Criteria 5
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[/TR]
[TR]
[TD]If Qualifying EU LDD = Yes or No
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]Date Equivalency Required By < KYC Next Renewal date
[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]KYC Risk Rating = High
[/TD]
[/TR]
[TR]
[TD]OR
[/TD]
[/TR]
[TR]
[TD]CLE PEP = PEP
[/TD]
[/TR]
[TR]
[TD]THEN "5 update to target location - Remediation"
[/TD]
[/TR]
</tbody>[/TABLE]

let me know if you have any questions!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
USAGE: =getResult()

I'm not sure on your: 'OR Pep="PEP"' logic.
adjust at will.

Code:
Function getResult()
Dim vEU, vMigDte, vRenDte, vEQDte, vKycRisk, vPEP
Const kNO = "No"
Const kYES = "Yes"
Const kLO = "Low"
Const kMED = "Medium"
Const kHI = "High"
Const kPEP = "PEP"

 'Range("A1").Select
vEU = ActiveCell.Offset(0, -6).Value
vMigDte = ActiveCell.Offset(0, -5).Value
vRenDte = ActiveCell.Offset(0, -4).Value
vEQDte = ActiveCell.Offset(0, -3).Value
vKycRisk = ActiveCell.Offset(0, -2).Value
vPEP = ActiveCell.Offset(0, -1).Value


Select Case True
    '1
  Case vEU = kYES And (vKycRisk = kLO Or vKycRisk = kMED) And vPEP = kNO And vRenDte >= Date
      getResult = "Ready to Migrate"
    '2
  Case vEU = kNO And (vKycRisk = kLO Or vKycRisk = kMED) And vPEP = kNO And vEQDte > vRenDte
      getResult = "2 update to UK standard required at next schedule renewal"
    '3
  Case vEU = kNO And (vKycRisk = kLO Or vKycRisk = kMED) And vPEP = kNO And vEQDte < vRenDte
      getResult = "3 update to UK standard required - remediation"
    '4
  Case (vKycRisk = kHI) And vEQDte > vRenDte Or vPEP = kPEP
      getResult = "4 update to target location scheduled renewal"
      
    '5
  Case (vKycRisk = kHI) And vEQDte < vRenDte Or vPEP = kPEP
      getResult = "5 update to target location - Remediation"
    
  Case Else
    getResult = ""
End Select
End Function
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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