VLOOKUP With Duplicate Values - excel

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.

Related

How to sum with index match formula in MS excel

I would like to sum the data in column F (Sheet1) and show the result in column B (Sheet1)(From B4 to B9).
But the sum range should be created using vlookup or index/match.
The column E in sheet1 matched with Column B in sheet2 and take the column A values in sheet2.
Then sum the data in column F (Sheet1)
=SUMIF(E4:E13;VLOOKUP(A4;Sheet2!A17:B30;2;FALSE);F4:F13)
=SUMIF(E4:E13;INDEX(A17:A30;MATCH(A4;Sheet2!B17:B30;0);1);F4:F13)
I used the formula above but its not working.
Vlookup takes only first value And index macth showing wrong number.
Can anyone help me? Thanks
Plz try this starting in B4:
=SUMPRODUCT(F$4:F$13*COUNTIFS(A$17:A$30;A4;B$17:B$30;E$4:E$13))
(I am testing this in Excel 365 - it may need array entering in Excel 2010).
Assumes there are no duplicates in the Sheet2 data - if there were, you would need:
=SUMPRODUCT(F$4:F$13*(COUNTIFS(A$17:A$30;A4;B$17:B$30;E$4:E$13)>0))
In case a 2 steps solution may work for you, you can do:
Formula in cell C17 is =IFERROR(VLOOKUP(B17;$E$4:$F$13;2;FALSE);0)
Formula in cell B4 is =SUMIF($C$17:$C$30;$A$17:$A$30;A4)
Drag down both formulas

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.

Vlookup based off of resulting text of a formula

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

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.

Find similar items in two columns in Excel

I want to know how can I do this in Excel.
Here is a sample
column A column B
-------------------------
1 2
2 5
3 4
4 1
5 3
I want Excel to check column A and B, then if it finds any match, move them to another sheet.
So in another sheet, I should have a list with its data sorted in front of each other based on similar code.
Click here to see the photo
thanks
Use match()
Sheet2:
A1:
=A1
B1:
=indirect("sheet1!B"&match(sheet1!A1,sheet1!B:B,0))
I have not tested it but A1 should give you the value of sheet1 A1 and B1 should give you the matched value (if it excists) of A1.
I can't test it as I'm laying in bed with my phone.
Because I'm at work I have to use Swedish formulas, but it's the same formula, it's only translated.

Resources