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
Related
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
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.
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
I have a few columns for example:
a b c
1 1 0
1 1 0
0 1 0
So I can easily find out if they are equal or not (row 1 = row 2):
=and(a2=a3,b2=b3,c2=c3)
When doing this for comparing row 2 to row 3 we get FALSE, however I'd like to know a way to find out which column(s) caused the fail. In this case it would return column a.
EDIT
I guess I could check each column individually and then search for FALSE's on that row of results, but seeking something more elegant.
Here, I got one for you. This formula is for matching ROW 1 and ROW 2 of your sample data.
=IF(AND(A1=A2,B1=B2,C1=C2),"Matched","Unmatched Column: " & IF((A1=A2),"","A") & IF((B1=B2),"","B") & IF((C1=C2),"","C"))
If you want to matched more than two row, don't worry, put that formula in first row and drag the cell value to the last row. So, every row will filled with related formulas.
I think that the another way is making with excel-vba and no more way to do. If you found the other way, post it. We will vote.
Good Luck.
You can also use conditional formatting.
Highlight the range A3:C4, Choose Conditional Formatting | New Rule | Use a formula... and enter
=A2<>A3
then choose a format (e.g. fill colour) to highlight the cells that don't match.
The formula automatically changes to =A3<>A4 for the second and third rows of data, so will highlight cell A4.
I have the following data set: and use the index/match function to check if the value in column A has a corresponding value in column b compared to values that are in another sheet called Data:
=IFERROR(INDEX(B:B,MATCH('Data A1'!,A:A,0)),"")
The goal of this exercise is to identify there is value in column B for any value in column A and here is where my formula fails, because for value 2 the formula returns an empty cell, because it is only checking for the first value in the list and not all values.
Any ideas on how I can fix the formula to reflect ABC when the value 2 is in the list? I am hoping for an outcome like this:
Thanks for your help!
It may be better to use a blank column to do this. In a blank column put the following formula in the first row:
=IF(B1="",SUMPRODUCT(($B$1:INDEX($B:$B,MATCH(1E+99,$A:$A))="")*($A$1:INDEX($A:$A,MATCH(1E+99,$A:$A))=A1)),B1)
Then Copy down the range.