Match on multiple columns - excel

I have two Excel sheets - both have these columns:
Col 1 Col 2 Col 3
In the first sheet, I also have an additional column at the end which will be a formula to see a row with the same three values as above exist in the other sheet. If the row can be found, I want to display 'Yes', else 'No'. I've toyed with VLOOKUP's etc but no joy.
Any tips?

If your version of Excel have COUNTIFS, then that should do the trick.

If you don't have countifs formula, you can do the poor man's version (what I did with Excel 2003 way back when) and combine the columns. So in Col4, put formula
=Col1 & Col2 & Col3
Then you can place your Yes/No If formula in Col 5. Suppose the three data points are named cells (this, that, the). The formula would look like:
=IF(Col4 = this & that & the), "Yes", "No")

Related

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

How to compare columns in different excel sheets

Compare 3 columns in excel sheet 1 with the 3 columns in excel sheet 2 and the same values return a result of column 4 of excel sheet 1 in a column of excel sheet 2
If I understand your question correctly, this sounds like a simple IF statement to compare the columns in sheets 1 and 2
you would essentially put the following code (you must convert the pseudocode to a "real" formula yourself) in column 4 on sheet two:
=IF(AND(Sheet1!A1 = A1, Sheet1!A2 = A2, Sheet1!A3 = A3), ResultIfTrue, ResultIfFalse)
This does it without concatenation of cricketbird's solution.
A simple approach would be to make a new column (E) in each sheet that concatenates the other 3:
=A1 & B1 & C1
This combines all three items into one column. You can then VLOOKUP this value in the corresponding concatenated column in the other sheet, and return the value in the column 4 that you want..
Give a few more details about your setup and what you've tried so far, and we may be able to provide more help.

Group 2 columns and sum values for another column

I have the following problem: I need to group data and perform a sum in another column in libreoffice calc/excel spreadsheet, just like a group by would do in SQL
In the following example, I would like the cells A26, A27 to become one line, and cell C26 should be the sum of the 2 rows.
Try on E26 cell the formula =($A26 & $B27) (Or =($A26 & (-$B27)) if you want a dash between A26 and B27).
And on F26 cell =($C26+$C27) for the sum of rows.
Copy/Paste for the other cells of each col

Excel, returning what's not equal when comparing columns

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.

Deleting entire row based on first 2 cell values in Excel

I have an excel sheet with 2000 rows and 3 columns. I am looking for a solution for "deleting entire row if cell 1 and cell 2 of every row are equal. In other words,
Cell1 Cell2 Cell3
ID1 id1 val1 -delete
ID4 id1 val1 -retain
ID2 id2 val1 -delete
ID2 id1 val1 -retain
I saw a lot of answer in VBA, but I am looking for an excel solution.Thanks.
I saw a lot of answer in VBA, but I am looking for an excel solution.
I'm not sure what do you exactly mean by "excel solution", but you can add 4th column with formula:
=a2=b2
Fill the entire column with it.
Add autofilter, select TRUE in 4th column and delete all rows.
Alternatively (if you do not want the extra column), you can use conditional formatting with the same formula, set background of the cells to some unused color, and then again use autofilter to find cells with this background color.

Resources