Find value from one cell, copy value from cell near to that cell and paste it to another sheet - excel

I have 2 sheets with different values. I need to find a value from one cell.sheet1 in sheet2 and copy value from nextcell_in_the_same_row.sheet1 to nextcell_in_the_same_row.sheet2.
It is very difficult to explain let look at the example bellow.
E.g.
Before
first sheet:
A B
1 aaa 123
2 bbb 456
3 ccc 789
4 ddd 122
second sheet:
A B
1 aaa
2 ada
3 cca
4 ccc
After
first sheet:
A B
1 aaa 123
2 bbb 456
3 ccc 789
4 ddd 122
second sheet:
A B
1 aaa *need to find value in the first sheet and copy value from B2 because aaa in A1*
2 ada *value does not exist in the first sheet so copy nothing*
3 cca *not need to copy because no value in the first sheet*
4 ccc *need to copy the value from B3*
Thank you so much!

Use a VLOOKUP along with an IFERROR.
=IFERROR(VLOOKUP(A1, Sheet1!A:B, 2, 0), "")
This will do what you described (well described, by the way!) in your question. Drag the formula down in Sheet2 till the bottom.
VLOOKUP takes the value of A1 in sheet 2 (no sheet reference because the value is in the same sheet as the formula) and looks it up in column A of Sheet1.
It returns the second value (hence why 2) of the table selected in the formula (column A is 1, column B is 2).
The 0 tells the VLOOKUP to look for exact matches. You don't need approximate match here.
And IFFERROR is there in case VLOOKUP doesn't find anything (like with ada) and instead of giving #N/A, returns an empty cell, "".

Related

Excel case insensitive sum product

I am trying to do a sum product to compare a cell to a column in another sheet and bring the value in another column associated to the match.
Using :
=SUMPRODUCT(Item_mst!$H$1:$H$4,--(A1=Item_mst!$B$1:$B$4))
sheet 1
Item
A
1 aaa
2 bbb
3 ccc
Item_mst
Item Qty
B H
1 aaa 20
2 AAA 10
3 AAA 20
4 AAA 20
The above formula gives me aaa/AAA = 60 while the correct value answer I expect is 70. Its not picking up the item when the qty is different and the case doesnt match.
SUMIFS would be a better solution
But, to answer the actual Q, try
=SUMPRODUCT(Item_mst!$D$1:$D$4,--(LOWER(H1)=LOWER(Item_mst!$B$1:$B$4)))

How to sum +1 if value exists

Hard to explain and english is not my native language, but i'll do my best. I have a cell with a CONCATENATE formula which creates a "code" value to identify different articles. The CONCATENATE formula is getting the values from 6 different cells. I need the 6th cell to sum +1 if the value of the other 5 cells already exist.
For example:
1
AAA
2
BBB
3
CCC
4
DDD
5
EEE
6
NNN (where NNN is a specific 3 characters number)
CONCATENATE creates the AAABBBCCCDDDEEENNN code. For the first article, it will be AAABBBCCCDDDEEE001. Then, if I create another article with AAABBBCCCDDDEEE, I want to 6th cell to fill up with 002, since 001 already exists.
Is that possible?
Thanks in advance.
If you enter '001 for the first cell in your 6th column, you can use this formula in the cell below it and copy it for all the cells below.
=IF(CONCATENATE(B2,C2,D2,E2,F2)=CONCATENATE(B1,C1,D1,E1,F1),CONCATENATE("00",G1+1),"001")

Comparing two columns in excel, inserting blank rows moving associated data

I have a large set of data in excel that needs to be matched by column. Specifically, the data currently looks like:
Column 1 Column 2 Column 3
1 1 aaaa
2 3 bbbb
3 4 cccc
4
Ideally, I want the data to look like:
Column 1 Column 2 Column 3
1 1 aaaa
2
3 3 bbbb
4 4 cccc
I've looked at different ways of comparing Column 1 and Column 2 (similar to this), but haven't found a good way to a) insert the blank space where column 1 and 2 don't match and b) also attach the data in column 3.
Any help would be greatly appreciated! Thanks!
If you want / can use directly Excel:
In the cells of Col "D" put this formula:
=IFERROR(MATCH(A2;$B$2:$B$8;);"")
In the cells of Col "E" put this formula:
=IF(D2<>"";INDEX($B$2:$C$8;D2;1);"")
In the cells of Col "F" put this formula:
=IF(D2<>"";INDEX($B$2:$C$8;D2;2);"")
Copy and paste for all the cells.
The good think it's that it's autoupdated... Or when finish copy and paste with value.

How to compare 2 cells to another 2 cells in a different sheet in excel?

I want to know how to compare or know the difference of 2 cells to another 2 cells in a different sheet in excel 2007
Example:
Sheet 1
A B
1 101 KIWI
2 102 APPLE
3 103 BANANA
Sheet 2
A B
1 101 KIWI
2 102 APPLE
3 103 ORANGE
I want to show the there is a difference in 3rd row on Sheet 1 and 2
Thanks
If you put =A1&B1 in C1 of each sheet and copy down then it is like comparing single columns. So with, in D1:
in Sheet1: =MATCH(C1,Sheet2!C:C,0)
in Sheet2: =MATCH(C1,Sheet1!C:C,0)
copied down in each case the resulting numbers should show the row number where the match is on the 'other sheet' (the lists need not be sorted) and otherwise #N/A for where matches have not been found.
There is obviously no need for the concatenation for the example provided, since the two 'A' columns are identical, but I take it that was because the example was simplified.

Excel Consolidating Text String (Yes/No)

Trying to combine the data into one master sheet. I have something like below:
Sheet 1 Sheet 2 Sheet 3
Name Gain(Y/N) Name Gain(Y/N) Name Gain(Y/N)
AAA Y AAA Y AAA
BBB N BBB BBB N
CCC CCC Y CCC Y
DDD DDD DDD Y
EEE EEE EEE N
Ultimately would look something like (merging all the sheets into sheet1)
Sheet 1
Name Gain(Y/N)
AAA Y
BBB N
CCC Y
DDD Y
EEE N
The problem is that consolidate function won't work for Text string (Y/N)
I am thinking something like 'if vlookup' or match index? but for multiple reference?
and not overriding each other. Maybe there is simpler way...
Thanks for your help :D
=IF(OR(Sheet1!B2="Y",Sheet2!B2="Y",Sheet3!B2="Y"),"Y",IF(OR(Sheet1!B2="N",Sheet2!B2="N",Sheet3!B2="N"),"N",""))
in B2 of a new sheet and copied down may suit.
Edit Simplification of revised formula to reflect edit to question:
Filter Sheet1 for Gain (Y/N) (assumed to be ColumnB) for (Blanks) and in the cell with the smallest visible row number enter:
=IF(OR(VLOOKUP(A4,Sheet2!A:B,2,0)="Y",VLOOKUP(A4,Sheet3!A:B,2,0)="Y"),"Y",IF(OR(VLOOKUP(A4,Sheet2!A:B,2,0)="N",VLOOKUP(A4,Sheet3!A:B,2,0)="N"),"N",""))
Change 4s in A4s to smallest visible row number (adjust column references as necessary) and copy down as required.
If you don't mind creating an extra column on each sheet, you could turn "Y" and "N" into a number. Assuming your labels are in column A, you insert a new column B and put the following in B2:
=IF(A2="Y", 3, IF(A2="N", 2, 1))
Repeat for all sheets. Now you can do consolidation, using the "MAX" function. It will return 2 if the letter "Y" appeared anywhere, etc. Now you can get back to Y/N/blank by putting the following formula in a column next to the consolidated data:
=INDEX({" ","N","Y"}, B2)
This will return " " if B2 is 1, "N" if B2 is 2, etc. Finally you can copy the entire column, and "paste special - values" to get exactly what you wanted.
You might as well use Microsoft Query to fetch all the data into a pivot with a code similar to this:
SELECT Name, Gain, 'Sheet1' as [Sheet#]
FROM Sheet1
UNION
SELECT Name, Gain, 'Sheet2' as [Sheet#]
FROM Sheet2
UNION
SELECT Name, Gain, 'Sheet3' as [Sheet#]
FROM Sheet3

Resources