lookup logic to interrogate specific exceptions

bdav1216

New Member
Joined
Mar 19, 2016
Messages
37
Office Version
  1. 2016
Platform
  1. Windows
Hello,


See the below data example.


Purpose: Output a 'Y' or 'N' based on a look-up. If the data is found in the columns in the look-up, a 'Y' is output, else 'N'.


This is probably a IF/THEN type logic, but your assistance is greatly appreciated!


Logic/Rules:


1) If the look-up matches 'Account Name' in Column A of the 'Data' tab to 'Account Name' in the 'ReClass' tab, output a 'Y'. If the value of 'Y' is matched, no other work is required, but if the look-up doesn't find a match, the values of 'ID' and 'VER' need to be checked.


Examples:
- Row 2 outputs a 'Y' because 'Account Name' is found in the look-up column. When this occurs, no additional checks are needed.
- Row 3 would output a ' N' because 'Account Name' is NOT found in the look-up column. When this occurs, move on the to the next checks. The 'ID' or 'VER' is not found either so a value of 'N' is output.
- Row 4 would output a 'Y' because 'Account Name' is NOT found in the look-up column. When this occurs, move on the to the next checks. The 'ID' was found so a value of 'Y' is output.


When the first search doesn't find a match, check.....
It is possible to have a 'Y' value when the 'ID' and 'VER' fields have values found in the look-up, however, there will be situations where the 'VER' field is found in the look-up, but the 'ID' is not, and thus, outputs a 'N' value so these need to be checked independently else this would over count.


2) IF Column B ('ID') in 'Data' tab is found in the look-up in Column B in the 'ReClass' tab, output a 'Y' in Column D in the 'Data' tab. If it's not found, move to the next set of logic for a 2nd chance.


Examples:
- Account Name was not found in the look-up, but Row 5 of the 'Data' tab matches on Column B (ID) to Column B of the 'ReClass' tab. Since this value matches, the evaluation is complete and a 'Y' is output in Column D of the 'Data' tab.
- Account Name was not found in the look-up, but Row 7 of the 'Data' tab matches on Column B (ID) in 'Data' tab. Since this value matches, the evaluation is complete and a 'Y' is output in Column D of the 'Data' tab.
- Row 6 and 8 had different ID values that were not found in the look-up so output a 'N' value.


3) Check Column C (Ver) column. If this field's value is found in the lookup, a 'Y' is output in Column C of the 'Data' tab.


Examples:
- Row 9 output a 'Y'. Although the 'ID' field (Column B) is blank and the account name also didn't match, Column C ('Ver') is found in the look-up.
- Row 10 outputs a 'Y'. Although the 'ID' field (Column B) is present it isn't found in the look-up and the account name also didn't match. However, Column C ('Ver') is found in the look-up.
- Row 11 outputs a 'N'. Neither the Account Name and 'ID' field are found in the look-up. Column C ('Ver') is also not found in the look-up.


Data Tab:

[TABLE="width: 595"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Account Name[/TD]
[TD]ID[/TD]
[TD]VER[/TD]
[TD]Match[/TD]
[/TR]
[TR]
[TD]ATT[/TD]
[TD]ATT01[/TD]
[TD]XXX[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]SNAP[/TD]
[TD]SNAP01[/TD]
[TD]XXX[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]TRAP[/TD]
[TD]TRAP01[/TD]
[TD]XXX[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]AAA[/TD]
[TD]CIT111[/TD]
[TD]XXX[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]STAT[/TD]
[TD]STAT111[/TD]
[TD]YYY[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]STAT[/TD]
[TD]STAT112[/TD]
[TD]YYY[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]STAT[/TD]
[TD]STAT113[/TD]
[TD]YYY[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]TOB[/TD]
[TD] [/TD]
[TD]COM[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]TOB[/TD]
[TD]TOB1A[/TD]
[TD]COM[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]TAT[/TD]
[TD]TOB1C[/TD]
[TD]XXX[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]ATT[/TD]
[TD]STAT112[/TD]
[TD]COM[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]ATT[/TD]
[TD]STAT113[/TD]
[TD]COM[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]ATT[/TD]
[TD]STAT113[/TD]
[TD]XXX[/TD]
[TD]Y

[/TD]
[/TR]
</tbody>[/TABLE]



ReClass Tab:

[TABLE="width: 562"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD]Account Name[/TD]
[TD]ID[/TD]
[TD]VER[/TD]
[/TR]
[TR]
[TD]ATT[/TD]
[TD]TRAP01[/TD]
[TD]ZZZ[/TD]
[/TR]
[TR]
[TD]BCD[/TD]
[TD]CIT111[/TD]
[TD]YYY[/TD]
[/TR]
[TR]
[TD]ECF[/TD]
[TD]STAT112[/TD]
[TD]COM[/TD]
[/TR]
[TR]
[TD]DGDE[/TD]
[TD]TOB1D[/TD]
[TD]BXZ[/TD]
[/TR]
[TR]
[TD]DRDS[/TD]
[TD]TRAP02[/TD]
[TD]ZXB[/TD]
[/TR]
[TR]
[TD]DED[/TD]
[TD]TRAP03[/TD]
[TD]AZF[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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