copy values of a column from one sheet to another sheet based on value of first column [duplicate] - excel

This question already has answers here:
Remove #N/A in vlookup result
(4 answers)
Closed 4 years ago.
This is my first excel task and I am a bit lost. Here are my sheets:
sheet1
name product_id
ABC
DEF
ERG
ZYT
sheet2
name product_id
ABC 1
DEF 2
WRT 8
ERG 9
Now what i want is for sheet product_id field to be filled in based on name field of the sheets. E.g. ABC is 1 in sheet 2 and in sheet 1, i need it to become 1 also. The number of rows differ (sheet 1 is shorter) and any not found names in sheet 1 should be ignored. In the end, I need sheet 1:
sheet1
name product_id
ABC 1
DEF 2
ERG 9
ZYT
Since ERG and ZYT are not found in sheet 2, they should be ignored. The order of the names could be different so I am looking for away to scan/loop and replace, if i am making any sense.
I have seen this https://www.extendoffice.com/documents/excel/4112-excel-copy-column-based-on-cell-value.html but it keeps on saying formula incorrect.
I am not familiar with VBA so it would be nice if it can be done using simple excel formulas.
Update:
following the suggested answer, i did come close but somehow rows are skipped if A column (searched column) don't match

You can do this with a VLOOKUP. This goes in your sheet 1 in cell B2, then drop this down to your last cell
=IFERROR(VLOOKUP(A1,Sheet2!A:B,2,0),””)
If it does not find your value it will return “”. You can put anything inside the quotes if you want it to show something else, like maybe “Stack Overflow is Awesome”

Related

Excel Compare values from two tables and copy data [duplicate]

This question already has answers here:
Excel Lookup function for text [duplicate]
(2 answers)
Excel formula to copy data adjacent to a cell and paste it next to a duplicate cell in another column
(2 answers)
Excel Formula for Inventory
(1 answer)
Excel - find cell with same value in another worksheet and enter the value to the left of it [duplicate]
(2 answers)
Check if an excel cell exists on another worksheet in a column - and return the contents of a different column
(1 answer)
Closed 1 year ago.
I have a small Excel task that I am stuck on.
I have two Excel tables and would like to fill table 1 with values from table 2.
Example:
Table1:
A
B
C
D
E
1
Dude
2
Table2:
A
B
C
D
E
1
Max
Muster
Way
3
53
2
Dude
Test
Street
42
44
The formula should now copy the value from Table2 B2 in Table 1 for B1.
This means that the formula must find the correct row in table 2 using the value in table 1 A1 and copy the value from column B.
Does anyone have any ideas?
An easy way would be using INDEX and MATCH:
My formula in column I is:
=INDEX($B$1:$E$2;MATCH($H1;$A$1:$A$2;0);1)
Notice last argument of INDEX is 1 for column I, 2 for column J, 3 for column K and so on. Depending on where is your data you may need to adapt this part. And for sure you can use another formula to autoselect proper column instead of typing 4 different formulas, but as I said, this would be the easiest way (not the cleanest, tough)

How can I use a relative range in an excel function

newbie with advance excel here. :)
I'm looking for a solution how to use dynamic or relative range with the expression I came up with. I have this excel sheet with multiple columns, but I only need to check 4 columns for info. The sheet has like 1000 rows and growing, and I need to go through each row and check for blank cells in each row. Obviously dragging the cell with my formula using the mouse automatically updates the cell reference on the expression. However, I'm going to use the expression in an automation tool where it looks one row at a time and captures the value into another "array" or "collection" variable.
Col A B C D
Student1 7 8 0
Student2 2 1 2
Student3
Student4 1 0 2
Student5
Student6 8 2 4
Student7
Student8 3 1 2
I have this excel expression
=IF(AND(A2 <> "", A3<>"", A4<>""),A1,"empty")
Expected results should be like the below and placed in another Sheet (Same workbook)
Student3
Student5
Student7
Thanks in advance!

need to copy data from one sheet to another depending on a value of the first sheet

i have never used excel except for in college and well that was a while ago, what i have is 3 sheets sheet 1 contains all user information sheet 2 is company information and sheet 3 is company member information,
now what i need to do is this,
i need to loop through sheet 1 column K and search for what is not "Individual" then i need the value of sheet 1 column A and put that in sheet 3 column C
i also need the index of the same row that does not equal "Individual" and use that to grab the value of sheet 2 column A and put that in sheet 3 column B
hopefully that makes sense and is actually possible and any ideas would be greatly appreciated!

return multiple different values based on 2 criteria in excel

Hope you can help. I have 2 excel sheets that look like this:
Sheet1:
ID trnx Module
1 aj08 AA
2 aj08 AA
3 aj08 AA
1 CJ20 ps opex
1 CJ20 ps capex
2 cn22 HR
Sheet 2
ID trnx Module
1 aj08
2 aj08
1 ml81
3 aj08
2 cn22
1 cj20
1 cj20
3 mm02
The formula im using is
INDEX($G$2:$G$9,SMALL(IF(A2=$F$2:$F$9,ROW($F$2:$F$9)-MIN(ROW($F$2:$F$9))+1,"")&IF(C2=$H$2:$H$9,ROW($H$2:$H$9)-MIN(ROW($H$2:$H$9))+1,""),COUNTIF(A$2:A$2,A2)&COUNTIF(C$2:C$2,C2)))
I need "module" from sheet 2 to be populated based on matching ID and trnx, and if the ID matches but not the trnx, then it must that cell for module to "No Match".
The problem i am experiencing is that sheet 2 is populating the data incorrectly. For Example the second occurrence of ID "1" in sheet 2 is pulling out Module ps opex. it is suppose to be "No Match" since the trnx in sheet 2 is ml81.
please help!!! Thanks in advance:)
This won't address the part I asked in my comment where you have 'duplicate keys' but may help you anyway :
Since your key is really the combination of the Id and the trnx columns, I inserted a concatenated column (I used =CONCATENATE(trnx, "_", id) where those names refer to sheet locations, but you could just as readily concatenate in the other direction as well, or use some other delimiter. It's just to make a single key column (that we can sort on and search more easily.)
In sheet 2 I form the same key column from the values listed there, and then your module column becomes :
=IF(ISNA(VLOOKUP(I12,$C$10:$D$15,2,0)), "No Match", VLOOKUP(I12,$C$10:$D$15,2,0))
Where in that formula, I12 is the key cell we are looking up in sheet 2, and the absolute reference in the VLOOKUP is the data table in sheet 1.

Format Cells from 2 sheets, based on 4 column comparison

I need to find changed values in dataSet.
So I have 2 sheets with, in general, same data.
I have two columns: docID(which is unique key) and rev(which is not unique).
I need to find(highlight/display only/...) those rows, where for same docID from first sheet rev is different in the second sheet.
UPDATE 1
Sheet 1:
docID rev
1 5
2 6
3 1
Sheet 2:
docID rev
1 6
2 6
3 1
Only the first row makes an interest to me, as others did not changed.
UPDATE 2
simple if statement which should give some understanding what I need. In general this is done on similar test data set, so cells are incorrect.
=IF(NOT(AND($B6=Sheet1!$B6;$C6=Sheet1!$C6));1;0)
So values are NOT equal.
You can do this with a custom formula in Conditional Highlighting:
Select the top cell in the column docID column, then select the whole column (in the example, I assume that this is column A and you select A1 and the rev is in column B, same structure in both sheets. Adjust as to your needs)
Goto home->Conditional Formatting->New rules->Use formula to determine which cells to format and enter the following formula:
=VLOKUP(A1,Sheet1!$A:$B,2,0)<>B1
Click on format and select the format you need.
Done!

Resources