Evaluate content based on multiple criteria.

BillTony

Board Regular
Joined
May 3, 2017
Messages
70
I'm trying to find "matches" (loosely speaking...) in a 3 column table and displaying the results in a 4th column. Column A is the driver, and can hold up to 5 pre-defined values, or any COMBINATION of the 5 values. Columns B and C cannot hold any of the values found in Column A, and again, can hold 1 or multiple values. I have not included any coding as I have not yet found anything that works. I'm attaching an image that should be a pretty good representation of what I wish to accomplish
ANY HELP IS GREATLY APPRECIATED!

Multiple Value Selections.jpg
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
What matching are you actually wanting:-
- If a value in Cust_2 or Cust_3 contains one or more values from the Cust_1 column for the row in question, then count that as a match
OR
- If a value in Cust_2 or Cust_3 contains all the values from the Cust_1 column for the row in question, count that as a match

What values are you wanting to see in the Result column (Other than not "Error"):-
- If there is a whole or partial match in either column - insert the word "Match" in the Result column? If not, what are you wanting? The actual matching values, but not from which column

- A match between Cust 2 and Cust_1 or a match between Cust_3 and Cust_1
- e.g. Cust_2 matches with Val 1 but Cust_3 matches with Val 2 - what are you wanting in the Result column - the matching values or just the word "Match" in the Result column?
- Should columns containing matching values be highlighted in red

The red colour appears to confirm a "partial" or "whole" match between columns but if they are different matching values between Cust_2 and Cust_3 and Cust_1 - all values just show as red and you are no further forward in identifying the actual matching values.
 
Upvote 0
Thanks for the reply! Let's look at it this way (a single row at a time): If column A has ANY of the following values, either singly or a combination of any or all - A, B, C, D, or E - then neither column B nor C could contain that exact value. But NOT an EXACT match. For example if column A has A, B, E then both columns B and C can contain ANY of those values. I'm not looking for a "match" of the "string" found in column A, but rather a comparison or evaluation of the VALUES columns B and C. In other words, columns B and C cannot contain ANYTHING found in column A (other than a comma if more than one value is held in any of the columns). So again, perhaps "matching" is misleading. I am not looking to identify or specify any of the "like values," only that they are PRESENT. In that scenario I would have something like "FAIL" (a match or partial match) / "PASS" (no match of any value), etc. I do intend to use color coding / shading to identify WHERE the "errors" are found in each column, but that is more as a visual aid for the end user to see where and in which column the error is occurring. I hope this makes things a little clearer. Thanks again for the input!
 
Upvote 0
Two parts contradict things in my mind:-
- If column A has ANY of the following values, either singly or a combination of any or all - A, B, C, D, or E - then neither column B nor C could contain that exact value. But NOT an EXACT match.
- columns B and C cannot contain ANYTHING found in column A

Going through your initial image to confirm the expected result:-
Excel Row 2 - as Val 1 is also contained in Cust_2 column then the expected Result is "FAIL"
Excel Row 3 - as Val 2 is also contained in Cust_3 column then the expected Result is "FAIL"
Excel Row 4 - as Val 3 is also contained in Cust_2 column then the expected Result is "FAIL"
Excel Row 5 - as Val 4 is also contained in Cust_3 column then the expected Result is "FAIL"
Excel Row 6 - as Val 5 is not in either Cust_2 or Cust_3 columns then the expected Result is "PASS"
Excel Row 7 - as Val 1 & Val 2 are also contained in Cust_2 column then the expected Result is "FAIL"
Excel Row 8 - as Val 1 & Val 2 are also contained in Cust_2 column then the expected Result is "FAIL"
Excel Row 9 - as Val 1 is also contained in Cust_3 column then the expected Result is "FAIL"
Excel Row 10 - as Val 1, Val 3 & Val 4 are also contained in Cust_2 and Cust_3 columns then the expected Result is "FAIL"
Excel Row 11 - as Val 3 or Val 5 are not contained in Cust_2 or Cust_3 columns then the expected Result is "PASS"
Excel Row 12 - as Val 1 and Val 3 are contained in Cust_2 or Cust_3 columns then the expected Result is "FAIL"

And then highlight the rows in the Cust_1, 2 & 3 columns that contain a "match" and therefore overall result is "FAIL"
Does that agree with your requirements?
 
Upvote 0
Have solved with a load of additional columns and formulas - presumed you wanted formulas, rather than VB.

- Yellow columns are counting the number of values in the CUST_2 column/Row then confirming whether the values exist in the CUST_1 column, then counting the overall number of matches for CUST_2/CUST_1.
- Orange columns are counting the number of values in the CUST_3 column/Row then confirming whether the values exist in the CUST_1 column, then counting the overall number of matches for CUST_3/CUST_1.
- Conditional Formatting applied to CUST_1, CUST_2 and CUST_3 columns, so that:-
- CUST_2 column will have a yellow fill if there is a match between any values in CUST_1 and CUST_2 column / row
- CUST_3 column will have an orange fill if there is a match between any values in CUST_1 and CUST_3 column / row
- CUST_1 column, if there is only a match between CUST_1 and CUST_2 columns, then a yellow fill will be applied
- CUST_1 column, if there is only a match between CUST_1 and CUST_3 columns, then an orange fill will be applied
- CUST_1 column, if there is a match between CUST_1 and CUST_2 columns and CUST_1 and CUST_3 columns, then a red fill will be applied
- Formula inserted into the Results column confirming whether there are matches or not and outcome will be PASS / FAIL

(Hopefully I've followed the instructions properly to upload the excel solution with formulas etc)
Evaluate content based on multiple criteria.xlsx
ABCDEFGHIJKLMNOPQRST
1RowCUST_1CUST_2CUST_3ResultNo of values in CUST_2 ColumnIs first value in Cust_2 column in the Cust_1 ColumnIs Second value in Cust_2 column in the Cust_1 ColumnIs Third value in Cust_2 column in the Cust_1 ColumnIs Fourth value in Cust_2 column in the Cust_1 ColumnIs Fifth value in Cust_2 column in the Cust_1 ColumnCount of Cust_2 column matchesNo of values in CUST_3 ColumnIs first value in Cust_3 column in the Cust_1 ColumnIs Second value in Cust_3 column in the Cust_1 ColumnIs Third value in Cust_3 column in the Cust_1 ColumnIs Fourth value in Cust_3 column in the Cust_1 ColumnIs Fifth value in Cust_3 column in the Cust_1 ColumnCount of Cust_3 column matches
22Val1Val2, Val1Val2, Val3FAILas Val 1 is also contained in Cust_2 column then the expected Result is "FAIL"2OKMATCH   12OKOK   0
33Val2Val3Val2FAILas Val 2 is also contained in Cust_3 column then the expected Result is "FAIL"1OK    01MATCH    1
44Val3Val3, Val1Val5FAILas Val 3 is also contained in Cust_2 column then the expected Result is "FAIL"2MATCHOK   11OK    0
55Val4Val1Val4FAILas Val 4 is also contained in Cust_3 column then the expected Result is "FAIL"1OK    01MATCH    1
66Val5Val2, Val1Val3, Val4PASSas Val 5 is not in either Cust_2 or Cust_3 columns then the expected Result is "PASS"2OKOK   02OKOK   0
77Val1, Val2Val1, Val2Val4FAILas Val 1 & Val 2 are also contained in Cust_2 column then the expected Result is "FAIL"2MATCHMATCH   21OK    0
88Val1, Val2, Val3Val2, Val1Val5FAILas Val 1 & Val 2 are also contained in Cust_2 column then the expected Result is "FAIL"2MATCHMATCH   21OK    0
99Val1, Val2, Val3, Val4Val5Val1FAILas Val 1 is also contained in Cust_3 column then the expected Result is "FAIL"1OK    01MATCH    1
1010Val1, Val2, Val3, Val4, Val5Val1, Val4Val3, Val4, Val5FAILas Val 1, Val 3 & Val 4 are also contained in Cust_2 and Cust_3 columns then the expected Result is "FAIL"2MATCHMATCH   23MATCHMATCHMATCH  3
1111Val3, Val5Val1Val4PASSas Val 3 or Val 5 are not contained in Cust_2 or Cust_3 columns then the expected Result is "PASS"1OK    01OK    0
1212Val1, Val2, Val3Val3Val1FAILas Val 1 and Val 3 are contained in Cust_2 or Cust_3 columns then the expected Result is "FAIL"1MATCH    11MATCH    1
Sheet1
Cell Formulas
RangeFormula
G2:G12G2=LEN(C2)-LEN(SUBSTITUTE(C2,",",""))+1
H2:H12H2=IFERROR(IF(FIND(IFERROR(LEFT(C2,(FIND(",",C2,1)-1)),C2),$B2)>0,"MATCH","OK"),"OK")
I2:I12I2=IF(G2>=2,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(C2,",",REPT(" ",100)),100,100)),B2)>0,"MATCH","OK"),"OK")),"")
J2:J12J2=IF(G2>=3,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(C2,",",REPT(" ",100)),200,100)),B2)>0,"MATCH","OK"),"OK")),"")
K2:K12K2=IF(G2>=4,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(C2,",",REPT(" ",100)),300,100)),B2)>0,"MATCH","OK"),"OK")),"")
L2:L12L2=IF(G2>=5,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(C2,",",REPT(" ",100)),400,100)),B2)>0,"MATCH","OK"),"OK")),"")
M2:M12,T2:T12M2=COUNTIF(H2:L2,"MATCH")
N2:N12N2=LEN(D2)-LEN(SUBSTITUTE(D2,",",""))+1
O2:O12O2=IFERROR(IF(FIND(IFERROR(LEFT(D2,(FIND(",",D2,1)-1)),D2),$B2)>0,"MATCH","OK"),"OK")
P2:P12P2=IF(N2>=2,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",100)),100,100)),B2)>0,"MATCH","OK"),"OK")),"")
Q2:Q12Q2=IF(N2>=3,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",100)),200,100)),B2)>0,"MATCH","OK"),"OK")),"")
R2:R12R2=IF(N2>=4,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",100)),300,100)),B2)>0,"MATCH","OK"),"OK")),"")
S2:S12S2=IF(N2>=5,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",100)),400,100)),B2)>0,"MATCH","OK"),"OK")),"")
E2:E12E2=IF(OR(M2>0,T2>0),"FAIL","PASS")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D2:D12Expression=T2>0textNO
C2:C12Expression=M2>0textNO
B2:B12Expression=AND(M2>0,T2=0)textYES
B2:B12Expression=AND(M2=0,T2>0)textYES
B2:B12Expression=AND(M2>0,T2>0)textYES
 
Upvote 0
Solution
Thanks so much!
This is a great solution and works QUITE well!
Would love to see it in a VB format...
 
Upvote 0
Moving the Columns
Cell Value
A1 CUST_1
B1 CUST_2
C1 CUST_3
D1 Result

Clunky macros code below (Just doing the same thing as the excel formulas):-


VBA Code:
Option Explicit

Sub Matching_Values()
'*************************************************************************************************************
'* Are values in the CUST_1 Column contained in the CUST_2 and CUST_3 columns. Highlight columns and insert
'* values in the Results column confirming whether there are matches (FAIL) or not (PASS)
'* - Cells will be highlighted as Yellow when values are contained in the CUST_2 column/Row and also in the
'*   CUST_1 column
'* - Cells will be highlighted as Orange when values are contained in the CUST_3 column/Row and also in the
'*   CUST_1 column.
'* - Cells will be highlighted as Red when values are contained in CUST_1, CUST_2 and CUST_3 columns/Row
'*************************************************************************************************************
    Dim LastRow As Long, Result_Column As Long
    Dim Cond_Form As Range
    
    
'*************************************************************************************************************
'* STEP 1 - Confirm location of the Results column in Row 1 and the last occupied row.
'*        - Delete the columns after the Results column
'*************************************************************************************************************
    Range("A1").Select
    LastRow = 100
    Result_Column = 0
  
    With Sheets("Sheet1")
        With .Rows(1)
            On Error Resume Next
            Result_Column = .Find("Result", .Cells(.Cells.Count), xlValues, , xlByColumns, xlPrevious).Column
            On Error GoTo 0
        End With
    End With
    
    If Result_Column > 0 Then
        Columns(Result_Column + 1).Select
        Range(Selection, Selection.End(xlToRight)).Select
        Application.CutCopyMode = False
        Selection.Delete Shift:=xlToLeft
        Range("A1").Select
    Else
        MsgBox "There is no Column called 'Result' in Row 1 - macro stopped"
        GoTo Error_End:
    End If
    
'*  THE LAST ROW OF THE USED RANGE
    Range("A1").Select
    ActiveSheet.UsedRange
    LastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row

    If LastRow <= 1 Then
        MsgBox "There is no data in the columns - macro stopped"
        GoTo Error_End:
    End If



'*************************************************************************************************************
'* STEP 2 - Remove the Conditional Formatting from the CUST_1, CUST_2 and CUST_3 Columns
'*************************************************************************************************************
    Range(Cells(2, 1), Cells(LastRow, 3)).Select
    Selection.FormatConditions.Delete
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With


        
'*************************************************************************************************************
'* STEP 3 - Inserting the headings and formula for calculating whether there are matching values
'*************************************************************************************************************
    Cells(1, Result_Column + 1).Value = "No of values in CUST_2 Column"
    Cells(1, Result_Column + 2).Value = "Is first value in Cust_2 column in the Cust_1 Column"
    Cells(1, Result_Column + 3).Value = "Is Second value in Cust_2 column in the Cust_1 Column"
    Cells(1, Result_Column + 4).Value = "Is Third value in Cust_2 column in the Cust_1 Column"
    Cells(1, Result_Column + 5).Value = "Is Fourth value in Cust_2 column in the Cust_1 Column"
    Cells(1, Result_Column + 6).Value = "Is Fifth value in Cust_2 column in the Cust_1 Column"
    Cells(1, Result_Column + 7).Value = "Count of Cust_2 column matches"
    Cells(1, Result_Column + 8).Value = "No of values in CUST_3 Column"
    Cells(1, Result_Column + 9).Value = "Is first value in Cust_3 column in the Cust_1 Column"
    Cells(1, Result_Column + 10).Value = "Is Second value in Cust_3 column in the Cust_1 Column"
    Cells(1, Result_Column + 11).Value = "Is Third value in Cust_3 column in the Cust_1 Column"
    Cells(1, Result_Column + 12).Value = "Is Fourth value in Cust_3 column in the Cust_1 Column"
    Cells(1, Result_Column + 13).Value = "Is Fifth value in Cust_3 column in the Cust_1 Column"
    Cells(1, Result_Column + 14).Value = "Count of Cust_3 column matches"
        
    Cells(2, Result_Column + 1).FormulaR1C1 = "=LEN(RC[-3])-LEN(SUBSTITUTE(RC[-3],"","",""""))+1"
    Cells(2, Result_Column + 2).FormulaR1C1 = "=IFERROR(IF(FIND(IFERROR(LEFT(RC[-4],(FIND("","",RC[-4],1)-1)),RC[-4]),RC1)>0,""MATCH"",""OK""),""OK"")"
    Cells(2, Result_Column + 3).FormulaR1C1 = "=IF(RC[-2]>=2,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-5],"","",REPT("" "",100)),100,100)),RC[-6])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 4).FormulaR1C1 = "=IF(RC[-3]>=3,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-6],"","",REPT("" "",100)),200,100)),RC[-7])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 5).FormulaR1C1 = "=IF(RC[-4]>=4,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-7],"","",REPT("" "",100)),300,100)),RC[-8])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 6).FormulaR1C1 = "=IF(RC[-5]>=5,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-8],"","",REPT("" "",100)),400,100)),RC[-9])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 7).FormulaR1C1 = "=COUNTIF(RC[-5]:RC[-1],""MATCH"")"
    Cells(2, Result_Column + 8).FormulaR1C1 = "=LEN(RC[-9])-LEN(SUBSTITUTE(RC[-9],"","",""""))+1"
    Cells(2, Result_Column + 9).FormulaR1C1 = "=IFERROR(IF(FIND(IFERROR(LEFT(RC[-10],(FIND("","",RC[-10],1)-1)),RC[-10]),RC1)>0,""MATCH"",""OK""),""OK"")"
    Cells(2, Result_Column + 10).FormulaR1C1 = "=IF(RC[-2]>=2,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-11],"","",REPT("" "",100)),100,100)),RC[-13])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 11).FormulaR1C1 = "=IF(RC[-3]>=3,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-12],"","",REPT("" "",100)),200,100)),RC[-14])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 12).FormulaR1C1 = "=IF(RC[-4]>=4,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-13],"","",REPT("" "",100)),300,100)),RC[-15])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 13).FormulaR1C1 = "=IF(RC[-5]>=5,(IFERROR(IF(FIND(TRIM(MID(SUBSTITUTE(RC[-14],"","",REPT("" "",100)),400,100)),RC[-16])>0,""MATCH"",""OK""),""OK"")),"""")"
    Cells(2, Result_Column + 14).FormulaR1C1 = "=COUNTIF(RC[-5]:RC[-1],""MATCH"")"
    
    Range(Cells(1, Result_Column + 1), Cells(1, Result_Column + 14)).Font.Bold = True
    Cells.Select
    Cells.EntireColumn.AutoFit
    
    Range(Cells(2, Result_Column + 1), Cells(2, Result_Column + 14)).Select
    Selection.AutoFill Destination:=Range(Cells(2, Result_Column + 1), Cells(LastRow, Result_Column + 14)), Type:=xlFillDefault
    Range("A1").Select
    
    
    
'*************************************************************************************************************
'* STEP 4 - Inserting the Formula into the Results column. Copying down the rows and then removing formula
'*          and making them values
'*************************************************************************************************************
    Cells(2, Result_Column).FormulaR1C1 = "=IF(OR(RC[7]>0,RC[14]>0),""FAIL"",""PASS"")"
    Range(Cells(2, Result_Column), Cells(2, Result_Column)).Select
    Selection.AutoFill Destination:=Range(Cells(2, Result_Column), Cells(LastRow, Result_Column)), Type:=xlFillDefault
    Range(Cells(2, Result_Column), Cells(LastRow, Result_Column)).Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("A1").Select
    Application.CutCopyMode = False
    
        
        
'*************************************************************************************************************
'* STEP 5a - Applying the Conditional formatting from Range A2:C2 to the no of rows in the range - A2
'*************************************************************************************************************
   Range("A2").Select
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=AND(K2>0,R2=0)"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = True
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=AND(K2=0,R2>0)"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 49407
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = True
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=AND(K2>0,R2>0)"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 255
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = True
    
    
'*************************************************************************************************************
'* STEP 5b - Applying the Conditional formatting from Range B2:D2 to the no of rows in the range - B2
'*************************************************************************************************************
    Range("B2").Select
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=K2>0"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = True
    
    
'*************************************************************************************************************
'* STEP 5c - Applying the Conditional formatting from Range B2:D2 to the no of rows in the range - C2
'*************************************************************************************************************
    Range("C2").Select
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=R2>0"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 49407
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = True
    
    
'*************************************************************************************************************
'* STEP 5d - Copying the conditional formatting down the range.
'*************************************************************************************************************
    Range(Cells(2, 1), Cells(2, 3)).Select
    Selection.Copy
    Range(Cells(2, 1), Cells(LastRow, 3)).Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    
    
'*************************************************************************************************************
'* STEP 5e - Remove the conditional formatting but retain the colours
'*************************************************************************************************************
    For Each Cond_Form In Selection
        Cond_Form.Interior.Color = Cond_Form.DisplayFormat.Interior.Color
    Next

    Selection.FormatConditions.Delete
    Result_Column = Result_Column


        
'*************************************************************************************************************
'* STEP 6 - Confirm location of the Results column in Row 1 and the last occupied row.
'*        - Delete the columns after the Results + 1 column
'*************************************************************************************************************
    Range("A1").Select
    LastRow = 100
    Result_Column = 0
  
    With Sheets("Sheet1")
        With .Rows(1)
            On Error Resume Next
            Result_Column = .Find("Result", .Cells(.Cells.Count), xlValues, , xlByColumns, xlPrevious).Column
            On Error GoTo 0
        End With
    End With
    
    If Result_Column > 0 Then
        Columns(Result_Column + 1).Select
        Range(Selection, Selection.End(xlToRight)).Select
        Application.CutCopyMode = False
        Selection.Delete Shift:=xlToLeft
        Range("A1").Select
    End If
 
Error_End:

End Sub
 
Upvote 0
I know you already have a working solution, I just saw this and took it as a challenge to my ability to see if I could make it in a single formula with no helper columns and I'm sure it can be refined even further, but this is what I came up with:

Book1
ABCD
1CUST_1CUST_2CUST_3RESULT
2Val 1Val 2, Val 1Val 2, Val 3Error
3Val 2Val 3Val 2Error
4Val 3Val 3, Val 1Val 5Error
5Val 4Val 1Val 4Error
6Val 5Val 2, Val 1Val 3, Val 4 
7Val 1, Val 2Val 1, Val 2Val 4Error
8Val 1, Val 2, Val 3Val 2, Val 1Val 5Error
9Val 1, Val 2, Val 3, Val 4Val 5Val 1Error
10Val 1, Val 2, Val 3, Val 4, Val 5Val 1, Val 4Val 3, Val 4, Val 5Error
11Val 3, Val 5Val 1Val 4 
12Val 1, Val 2, Val 3Val 3Val 1Error
Sheet2
Cell Formulas
RangeFormula
D2:D12D2=IF(SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),B2),0))+SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),C2),0)),"Error","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A12Expression=SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),B2),0))+SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),C2),0))>0textNO
B2:B12Expression=SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),B2),0))>0textNO
C2:C12Expression=SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),C2),0))textNO
D2:D12Expression=SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),B2),0))+SUM(IFERROR(SEARCH(TRIM(TEXTSPLIT(A2,",")),C2),0))textNO
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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