Comparing two columns in two different excel sheets - excel

I have 2 excel sheets (sheet1 and sheet2)
Sheet1 has 10 columns, sheet2 has 20 columns (no:of rows are same )
Sheet2 contains all the columns that sheet1 have
Now, compare 12th column of sheet2 with 7th column of sheet1
This should result in another column names 'Matched?' in any of the sheet (lets say sheet 2)
This 'Matched?' columns should have 500 rows with values 'Yes' if matched (or) 'No' if not matched.
Note: Kindly please start explaining from the scratch about the provided VLOOKUP() function because i don't know about it.

This little formula will do the trick for you:
=IF(COUNTIF(Sheet1!G:G; L2)=0, "No match in Sheet1", "Match in Sheet1")
Where "Sheet1" is the name of the worksheet 1
You could then modify it to (the above formula is to clearly show the logic):
=IF(COUNTIF(Sheet1!G:G; L2)=0, "No", "Yes")
Assume we have Sheet 1:
Sheet 2, we apply our formula in the column V. It check if the word Apple (cell L2 exist anywhere in Sheet 1, column G). We do this for every row.
For next row we want to check if it exist in Sheet1, we apply the formula again, the only difference is that L2 -> L3 i.e. the reference value changes since you are looking at another row.

Related

Using VLOOKUP to match 2 cells sheet2 to sheet1 and return the 3rd cell

I have been using VLOOKUP() to populate worksheets with Inventories, however I'm stuck with an issue where one column has the same value in multiple cells, I need to match 2 cells from sheet 2 with sheet 1 and have it return the 3rd cell from sheet 1 into sheet 2.
I'm working with about 350 rows in both sheets, and in some cells the same/different values repeat it self hence needing it to match with 2 cells in the same row.
This is the formula I currently use:
=VLOOKUP(A1&L1,'Sheet1'!$A$1:$E$351,3,FALSE)
I'm expecting it to return the value that's in the 3rd column on sheet 1 in the row that matched the values of Cell A1 and L1 in sheet 2. and the same going on A2 & L2 then A3 & L3 and so forth.
Unless you have values in Column A of your 'Sheet1' that are the equal to to concatenation of your values in Columns A and L in 'Sheet2', the formula will not work.
Instead, I'd try FILTER if you have the newest version of Excel. Something like:
=FILTER('Sheet1'!$C$1:$C$351,
(('Sheet1'!$A$1:$A$351=A1)*('Sheet1'!$L$1:$L$351=L1)))
Another option is INDEX. Something like:
=INDEX('Sheet1'!$C$1:$C$351,
MATCH(A1&L1, 'Sheet1'!$A$1:$A$351&'Sheet1'!$L$1:$L$351,0),
3)
The only way to do this task is to use a helper column
Go to Sheet one where the data table is, insert a column at the starting point of data e.g your Data set starting in SHEET1 from the column A. so insert new column in A
use this formula in A1
=CONCATENATE(B1,C1,D1,E1,F1) Press Enter, Drag the formula down to A351
now go to sheet2 and use this formula in the result cell
=VLOOKUP(A1&L1,'Sheet1'!$A$1:$F$351,4,0)

Extract only rows that are not in both sheets into a third sheet

I have 2 excel sheets with similar column values (legal_id). Is there a way to extract only rows that are not in both sheets into a third sheet? For example if social security number 111111 isn't in both sheets, then that persons row would be placed in the third sheet..please see images below.
Sheet 1
Sheet 2
Sheet3_DesiredResults
Before I get backlash about not attempting code this is what I tried,
I thought this formula would highlight true or false to values that are not in the same sheet, then I could just delete every field that returned true to be in both sheets , but it doesn't work. I'm not a programmer, I need help. Please don't tell me to take a VBA tutorial.Instead of making a third sheet , I made a helper column on the first sheet and used the formula:
=(ISNA(MATCH(A2,Sheet1!A:A,0)))=FALSE
Like anticipated in my comment, you might use 2 ranges in the third sheet and the COUNT.IF function. The formulas you need are these:
=IF(COUNTIF(Sheet2!$A:$A,Sheet1!$A2)=0,Sheet1!A2,0)
.
=IF(COUNTIF(Sheet1!$A:$A,Sheet2!$A2)=0,Sheet2!A2,0)
Place them in 2 proper cell in the third sheet (let's say A2 and E2), drag them to cover the two lists. Empty cells or cells with IDs in both Sheet1 and Sheet2 will return 0. If you don't like 0 and you prefear "", you might use these:
=IF(IF(COUNTIF(Sheet2!$A:$A,Sheet1!$A2)=0,Sheet1!A2,0)=0,"",IF(COUNTIF(Sheet2!$A:$A,Sheet1!$A2)=0,Sheet1!A2,0))
.
=IF(IF(COUNTIF(Sheet1!$A:$A,Sheet2!$A2)=0,Sheet2!A2,0)=0,"",IF(COUNTIF(Sheet1!$A:$A,Sheet2!$A2)=0,Sheet2!A2,0))
I have solved your query. Please have a look below.
First as expected, i created 2 sheets with same data as mentioned in image for simplicity.
Sheet 1 with Helper column
Sheet 2 with Helper column
Step 2 : I converted the sheet data into table for efficiency.
Step 3 : I used the COUNTIF function and IF function in Sheet 1 Helper column throughout.
=IF( COUNTIFS(Sheet2!Legal_id, [#[Legal_id]]) = 0, "N/A","" )
Similiarly we have to implement this formula in Sheet 2 Helper column.
=IF( COUNTIFS( Book1!Legal_id, [#[Legal_id]]) = 0, "N/A", "")
Explanation of above formula: The COUNTIF Function counts number of corresponding occurrences of Legal_id, in Sheet 2 Legal_id column. If count = 0 i.e means legal_id is not present in Sheet 2, so we use IF statement to assign 'N/A' value in Helper column else nothing ''.
Same explanation follows for sheet 2.
Now We Filter the Rows with N/A values to delete as mentioned by you in comments. or Insert it in third Sheet by copy paste.
The best way to accomplish your task is to use vba. But, if you want to use the ISNA(MATCH formula, you will need to wrap your formula in an IF statement and place the formula in each cell in Sheet3.
STEP 1: Paste the below formula in Cell A2
=IF(ISNA(MATCH(Sheet1!A2,Sheet2!A:A,0)),Sheet1!A2,"")
STEP 2: hold down CTRL+SHIFT+ENTER to enter it as an array formula
STEP 3: Hover over the dot in the right-bottom corner of the cell and drag down to the number of used rows you have in Sheet1 Note: the formula will change for each row
STEP 4: Then drag across to Column C Note: the formula will change for each column
The data from Sheet1 that is not in Sheet2 will now be in Sheet3, separated by blank rows, you can select the blank rows and delete them.

Excel Vlookup Across Different Sheet

I have a excel file with 2 work sheets. They look like this:
Sheet 1:
Sheet 2:
I want to look up the value of column A (sheet1) when matched with column A (sheet 2) copy the value of column B (sheet 2) to column B (sheet 1).
I know I have to use vlookup but I really have no idea where to start with this.
An example of the result:
VLOOKUP works by taking a square range of data, looking at the first column of that data for a match you specify, and then returning the value of that row a given number of columns to the right. For example, in your case, it would look as follows [for B2 in sheet1, copied down]:
=VLOOKUP(A2,'Sheet2'!A:B, 2, FALSE)
This takes the value from cell A2, then looks at column A on sheet2. If it finds a match, it returns the value on the 2nd column of the table [ie: column B]. If there is no match, it will return #N/A. The FALSE means that it doesn't assume your data is sorted [if it is, you can use VLOOKUP to take a 'next best' value if there is no match.

If B2 in sheet 1 matches any cell on sheet 3, copy the next cell from sheet 3. (copying to sheet 1)

Anyone who could give me the excel formula for this? Thank you!
If B2 in sheet 1 matches any cell from column A of Sheet 3, copy the cell found on the right of that (column B).
Copying to a cell in sheet 1.
Thanks! (I hope this isn't too confusing.)
For example B2 is "8 December". Then there is a list of dates on Column A of Sheet 3. On column B of sheet 3 is a corresponding time. So for example, on the right of 8 December on Sheet 3 is 8:30, I want that to be copied on the cell I'm making a formula on.
Some folk use the LOOKUP function for this, but I like to use MATCH and INDEX because it gives you more freedom for more advanced formula (such as checking if there was a match or not) and has less requirements (such as data doesn't need to be sorted).
=INDEX(Sheet3!B:B, MATCH(Sheet1!B2, Sheet3!A:A, 0))
If you break it down into the parts, MATCH(Sheet1!B2, Sheet3!A:A, 0) returns the row number for the first matching cell in column A of sheet Sheet3. Then INDEX(Sheet3!B:B, ...) returns the value of the cell in column B of sheet Sheet3 at a specified row number.
If nothing matched, then you'll get a #NA error value.

Link two cells of a column in different sheets if a value in a cell of other column matches in other sheet

I have a workbook with 7 sheets containing part number of a product in column and its cost in adjacent column. And the 7th sheet contains total number of parts in all the sheets. I want to change cost of some products but then I have to do the same in all sheets. Is there a way by which it automatically finds and changes cost in individual sheets when i change it in the sheet containing total?
Use VLOOKUP on the first 6 sheets to match the price to each part number.
So, in each "cost" column on the first 6 sheets, enter this formula (assuming Cost on Sheet7 is still in column C):
=IFERROR(IF($A1="","",VLOOKUP($A1,Sheet7!$A:$C,3,FALSE)),"")
If you have header row(s) then just replace the two instances of $A1 in the formula with whatever the first row of data is (e.g. $A2), paste the formula into that row in column C on Sheet1, then drag-copy the formula down as far as you want. Repeat for sheets 2-6.

Resources