How to conditional format a column when it partially matches another - excel

first question here.
I have two columns.
COL1
COL2
MNR6788
6788
NJI89076
9089
GHJ9089
89076
ZZZ-909-8907
9087654
DFGT9098743
98756436
I want to conditional format a cell in COL1 when it partially matches any cell in COL2.
All data is randomised.
Example:
MNR6788 matches with 6788, so it gets highlighted
NJI89076 matches with 89076 so it gets highlighted (they are not in same row)
I tried using
=O:O
in the custom formula text box, but to no avail.
So to summarise, I basically want to tell excel to match each cell in COL2 with each cell in COL1, and highlight corresponding cell in COL1 if there is any match.
Can a formula like
=(partially matches any cell in COL2)
to put in the conditional formatting condition be achieved? I have been trying to do something like this for a long time now.

You can count how many values of COL2 partically match with value in COL1, and sum up. If result>0, then highlight.
I've created a Conditional Formatting Rule based on this formula:
=SUMPRODUCT(COUNTIF(A2;"*"&$B$2:$B$6&"*"))>0

Related

Cell value based on either of 4 other cells

What is the simplest formula in Excel to get my result column to show 1 if col1 is not empty, 2 if col2 is not empty, etc.? There will always only be one value in a row.
Edited as I misunderstood the question:
This should solve your issue.
=MATCH(TRUE;NOT(ISBLANK(B2:E2));0)
See the result

Excel: compare every other row with the one below and colorize cells if the value is greater

Consider the following data -
I want to compare every other row with the one below and colorize the cells if the value is greater as shown in the image.
If at all the data is sorted on some column, the colored cells should remain as they were initially. For example, the comparison should be between values A and B in COL1 for the same value ALPHA in COL2.
Can this be achieved by writing a formula and how it would look like? Thanks SO.
Conditional Formatting formula, applied to C2 (select C2 when creating the CF rule
=AND(MOD(ROW(), 2)=0, C2>OFFSET(C2,1,0))
Apply to your data block

Compare cell data in Column B to all of Column A and turn green when there is a match

In excel, I have the following:
I am trying to find the quickest and most user-friendly way to compare columns 2 and 1.
If a name in column 2 (in the format shown below) matches ANY of the cells in Column 1, the cell in Column 1 goes GREEN, indicating that user is PRESENT in Column 2.
I have played around with conditional formatting but would appreciate any direct and efficient solutions.
I was trying to adapt a version of this, but it failed to work:
=SUMPRODUCT(--(MID($A4&" "&$A4,FIND(",",$A4)+2,FIND(",",$A4&" "&$A4,FIND(",",$A4)+2)-FIND(",",$A4)-2)=$B$4:$B$33))
where the above formula was added on highlighting the first column and then ensuring the A4 referred to the first item in Column 1 and the B was the first and last item in column 2. As mentioned, this didn't work.
Update
Tried this as well but didn't work.
This answer written assuming column1 = column A, and column2 = column B
Apply a conditional format on column 1, set up with green background, with the formula =COUNTIF(B:B, A1)>0
Apply another conditional format on Column 1, set up with red background, formula =COUNTIF(B:B, A1)=0
Edit those formulas as necessary so that:
B:B is the address of column 2, the range you're looking in for each name
A1 is the address of the first (top-left) cell that the conditional format applies to.
You can select both columns and do Conditional Formatting, Highlight Cells, Duplicate Values. That would be the easiest way to compare. You can format the cells in the first list with red fill if you want them to be red and set the format for duplicate values with green fill. This will format it in the color scheme you showed. If the name is removed from the second column, the cell will go back to red.

Select a subset of excel Table given a value of given column

I have a Table in excel like the following one:
col1 col2
A 1
B 0
A 2
B 2
B 3
I was not able to find a way to select a subset of the table like this one using an excel function.
col11 col22
B 0
B 2
B 3
based on the value "B" of column col1 or just be able to select the col22' from the given subset.
I would like to have a solution that does not require to VBA nor array formula. I found on Internet the function FILTER, but it is not available yet and Structured References does not have such functionality.
I would like to use for example the result col22 as a column at another place of my spreadsheet. Other languages such as R, provide a function subset that does this in a pretty simple way. In excel it is really easy to filter using the Excel interface (filter button), but I am not aware of a function that does something similar programatically.
I had the same problem and the only thing I found on the internet was the FILTER function too.
I wanted to vlookup a subset of a table based on another column. My solution was to make another column that is the concatenation of the two. Then I used vlookup on this column.
I don't know what are you going to do with the subset table that you want to have. But you can do it in a different way as I did. May it helps.
Assuming col1 is A and col 2 is B and your result set's col1 and col2 are E and F respectively, try this formula in column C: =IF(A2=$E$2,MAX($C$1:C1)+1,0)
Now, in cell E2 (i left the first row for a header), i physically typed "B" to make this the input source and allowing for dynamic reporting. for as many cells below that as you wish, the following formula will only show the total number of "B"s that are in your input source: =IF(ROW(A2)>MAX(C:C),"",E2) Notice i did not fix the cells with $ as your following row depends on the former.
Cell F2 (the top of your col2 field for the result set) include: =INDEX(B:B,MATCH(G2,C:C,0)) and in G2 put: =IF(E2="","",G1+1) and copy both down as far as you have formulas in column E (or result set col1).
The reason for the IF statements is for formatting rather than displaying errors on failed lookups.
Goal: extract a subset of the current sheet only when values in the first column match a value in the first column of another 'Sheet1':
=VLOOKUP(A2,Sheet1!$A:$B,2,FALSE)
Add the formula above in the first cell of the first empty column, then sort Z-A this column and remove all "#N/A" rows, then re-order again A-Z the first column and remove this temporary column.

Convert an if & vlookup combination formula to arrayformula - Google Sheets

I have this formula working in Google Sheets:
=if(B3="",0,IF(ISERROR(VLOOKUP(E3,E4:E,1,FALSE)),1,0))
The logic is pretty straight forward:
if B3 is NOT NULL and there is no duplicate of E3 in range E4:E, write 1 else write 0
I tried to convert it to ARRAYFORMULA, coz it should be applied to all columns in E as and when the number of rows increase (via form submission), by doing this:
=ARRAYFORMULA(if(B3="",0,IF(ISERROR(VLOOKUP(E3:E,E4:E,1,FALSE)),1,0)))
But, it wrote 0 to all columns of E.
The reason here is that, the VLOOKUP should look in the E column range excluding the current row. I'm not sure how to achieve this.
Here is the Google Spreadsheet (please refer to Sheet2)
Can someone please correct my ARRAYFORMULA? Thank you.
You can't offset range used in ArrayFormula, so your original formula cannot be converted into ArrayFormula and remain result. But you may use this workaround:
=ArrayFormula(IFERROR(--(VLOOKUP(OFFSET(E3,,,COUNTA(A3:A)),QUERY({ROW(INDIRECT("A1:A"&COUNTA(A3:A))), OFFSET(E3,,,COUNTA(A3:A))},"select Col2, max(Col1) where Col2 <> '' group by Col2 label Col2 '', max(Col1) ''"),2,0)=ROW(INDIRECT("A1:A"&COUNTA(A3:A)))),0))
I used row function in this formula to compare it with maximum row when certain value appears.
Your sample file

Resources