Vlookup based off of resulting text of a formula - excel

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

Related

VLOOKUP With Duplicate Values

I have 2 sheets like the following:
Sheet 1
Sheet 2
I want to enter the values ​​from column B on Sheet 2 into column B on Sheet 1.
In Sheet 1 there are some double/duplicate data such as:
Aek Godang, dan Aek Kanopan
so when I use the formulas:
=VLOOKUP(A1,$Sheet2.A1:B15,2,1) or =INDEX($Sheet2.A1:B15, MATCH(A1,$Sheet2.A1:A15,0),2)
on row 14 where there is the same data as the previous row, it will always be an error
how to solve it or the formula so that the result can be like this:
within GS in B1 use:
=INDEX(IFNA(VLOOKUP(A1:A; Sheet2!A1:B; 2; )))
You need only this, enter the formula in cell B1 of sheet 1 and remember to press cse as its an array formula(for excel 2010 till 2019).
=SMALL(IF(A1='Sheet2'!A$1:A$15,ROW('Sheet2'!A$1:A$15)),1)
=INDEX('Sheet2'!B$1:B$15,SMALL(IF(A1='Sheet2'!A$1:A$15,ROW('Sheet2'!A$1:A$15)),1))
The first link given in the comment with countif doesn't work. Aggregate Function is not available in Google Sheet. In Libre office Small function does work.
With COUNTIF error will be showing, wrong way to resolve.

Excel vlookup returning same value for all records

I am using VLOOKUP to pick values from Sheet2
Sheet1:
Sheet 2:
My VLOOKUP formula in C2:C5 of Sheet1:
=VLOOKUP($A2&"|"&$B2,CHOOSE({1,2},Sheet2!$A$1:$A$4&"|"&Sheet2!$B$1:$B$4,Sheet2!$C$1:$C$4),2,FALSE)
My problem is that values are same for all records.
Below are the values I see when I do F9.
Why are the same values returned?
I can get lookup data from column 3 on sheet 2 using:
=VLOOKUP(A2,Sheet2!A1:C4,3)
This might also be working
=INDEX($C$1:$C$12;AGGREGATE(15;6;ROW($A$9:$A$12)/(A2&B2=$A$9:$A$12&$B$9:$B$12);1))
just adapt the ranges to your needs

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.

How can I return a lookup value from a third column from a reference value in two cells?

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))

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.

Resources