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.
Related
I have a large Excel data file, with data from two different sheets. I want to be able to match the partner_identifier values from SO Sheet 2 to the values in BB Sheet 1. For the rows in BB Sheet 1 that do match, I want to bring the entire row into a new sheet.
I need help coming up with a formula for this. I've tried VLOOKUP and IF variations, but I think I need a more complex formula. I can't do an =IF('SO Sheet 2'!D3='BB Sheet 1'!D3) because the matching values could be in different rows.
Right now, I have (and I know this is off because it returned "No" for every row, even the ones with a matching value) :
=IF(D3='SO Sheet 2'!D3:D16,'BB Sheet 1'!D3,"No")
Any insight would be greatly appreciated!
If you are using latest version of excel (Excel for Microsoft 365) - you can use XLOOKUP or FILTER formula.
Example:
= FILTER('SO Sheet 2'!A3:D16, 'SO Sheet 2'!D3:D16=D3)
Check here for details about these formulas: XLOOKUP, FILTER
You can achieve the result in 2 steps. in Sheet "BB sheet 1", you need to add a column E with XLOOKUP formula to find the matching identifier in "SO sheet 2"
=XLOOKUP(D2,'SO Sheet 2'!$A$2:$A$14,'SO Sheet 2'!$A$2:$A$14,"No")
The above will list all the matching identifier and put "No" wherever if couldn't match the identifier.
Then all you got to do is , in a new sheet, enter the formula in cell A1
=FILTER('BB sheet 1'!A:D,'BB sheet 1'!E:E<>"No")
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.
I have an excel file with two sheets. I'm trying to reference one sheet's numbers based on text using a formula in the other sheet. I have one sheet that looks something like this -
And another that looks like this -
I would like to put a formula on the first sheet that basically says - look on the second sheet for the values in columns A and B and return me the value in column C. The tricky part is - the values in the first sheet may be inverted or there may be an instance where only one value is present, like in row 1 in the first sheet. Also the formula should only fill in a value if both columns match. All text combinations in Sheet 2 are unique.
So for example - on the first sheet the formula should return 1 in cell C1, 5 in cell C4, and would error in the other 2 cells.
I hope that wasn't too confusing. I would greatly appreciate any help you can give.
Thank you!
Add two sumifs together:
=SUMIFS(G:G,E:E,IF(A1="","",A1),F:F,IF(B1="","",B1))+SUMIFS(G:G,F:F,IF(A1="","",A1),E:E,IF(B1="","",B1))
I am having an issue with a Vlookup formula.
the workbook contains 3 sheets.
I need to compare values from E2:E867 on sheet 2 with the values from C2:C867 on sheet 3 and return the value from sheet 3 column B on sheet 2. this should be relatively straight forward except the values from E2:E867 on sheet 2 are populate by another Vlookup formula so the vlookup I am writing is looking at the actual formula in E2:E867 on sheet 2 instead of the resulting values in E2:E867 on sheet 2.
how can I get the vlookup to compare the resulting values in E2:E867 on sheet 2 in stead of the formulas resulting values in E2:E867 on sheet 2.
formula that is used to populate E2:E867
=VLOOKUP($A489,'sheet 2'!$A$2:$L$867,7)
formula that is having issues
=VLOOKUP($E489,'sheet 3'!$C$2:$C$867,2)
it should return the value in column 2 from sheet 3 that matches the value of cell E489, but instead, when you step into the formula, it looks at the formula from E2:E867 .
I know I may not be asking the question clearly, so please let me know if you need some clarification.
thank you.
All credit goes to Scott Craner - use this formula: =INDEX('sheet 3'!B:B,MATCH($E489,'sheet 3'!C:C,0)) – this was exactly what I needed. Thank you Scott
In Excel, I have sheet 1 with column a (ID numbers) and column b (contract numbers), and sheet 2 with column a (ID numbers).
I need to find the ID numbers from sheet 2 in sheet 1, and copy the relevant contract numbers in sheet 2 (in a new column).
Can you please help with the formula?
Sounds like you could use the VLOOKUP formula for this. The VLOOKUP formula will look for a specified value in the left-most column of a table or range, and then returns a value from the same row of a column you specify.
For example, say you have the following on Sheet 1:
You would then use the VLOOKUP formula on Sheet 2 to find the ID in Sheet 1 and return the correlated Contract, like so:
You could use a "vertical lookup" function in your second sheet. Use something like the pseudocode below in the cell you want the information to appear in the second sheet .. where column 2 contains the information "looked up" in sheet one that you want.
=vlookup(-cell reference containing ID in second sheet-,-reference to all of sheet 1-,2,false)