Find the corresponding value in a separate table depending on another table in Excel - excel

I am trying to find the value in one table (Table 2), based on the location of a "Yes" in another table (Table 1). See below:
Table 1
Header1 Unique1 Unique2 Unique3
Row1 Yes
Row2 Yes
Row3 Yes
Table 2
Header1 Unique1 Unique2 Unique3
Row1 XXX
Row2 YYY
Row3 ZZZ
On another sheet, I have a column with "Unique1" or "Unique2" as follows and am trying to get the column that is labeled "Lookup":
Column1 Lookup
Unique1 XXX
Unique1 XXX
Unique3 ZZZ
Unique2 YYY

I am glad you got it working. I actually did manage to cram it into one formula.=INDEX(Sheet1!$A$5:$D$8,MATCH("Yes",INDIRECT("Sheet1!"&CHAR(CODE("A")+MATCH($A2,Sheet1!$1:$1,0)-1)&":"&CHAR(CODE("A")+MATCH($A2,Sheet1!$1:$1,0)-1)),0),MATCH($A2,Sheet1!$1:$1,0))
The way that works is it goes into your table 2 and picks out a row and a column. The column is whichever holds the name. The row gets constructed by looking for yes in the appropriate column. To name that column with a letter and not a number, I needed to convert with the whole CHAR CODE thing.

Related

find string in other column but same row vba

some cells in column D contains same numbers "123".
The macro needs to find the row of the string "xxx" in different column but same row that contains numbers "123".
This seems like a good INDEX(MATCH) use case.
If your table is something like
Col1
Col2
Col3
A
xxx
111
B
yyy
222
C
zzz
333
You can try something like
=INDEX(A2:C4,MATCH(B2,B2:B4,0),3)
Which will return 111 as you matched the row containing xxx and wanted column 3

Excel: How to add a column from other sheet based on a key column?

I have 2 list. Both have a lot of column. I would like to insert a column from Sheet2 to Sheet1 based on a ceratin key column. Also sheet2 have much more rows than sheet1 so it ll be inserted only partly and still there ll be elements with no matches. For an example:
Sheet1:
Names ID Car Color
John 1 Audi Empty
Andy 4 Toyota Empty
Mike 3 BMW Empty
Tony 2 Suzuki Empty
Sheet2:
ID Cost Color
6 200 Blue
3 200 Red
4 300 Green
5 100 Red
1 50 Black
I would like to get the "color" from Sheet2 to Sheet1 by using the "ID". Using Excel 2010. I suspect I need INDEX+MATCH combination, but the examples I can find are not detailed and more simple so I coudn't figure out how to use them.
How about inserting this formula on Column D in the first row, then dropping the formula down:
=VLOOKUP(B1,Sheet2!$1:$1048576,3,FALSE)
Or to find the column that contains "Color", use Index Match Match, as follows:
=INDEX(Sheet2!$1:$1048576,MATCH(Sheet1!B2,Sheet2!A:A,0),MATCH("Color",Sheet2!$1:$1,0))
This will find the value in Column B in Sheet2 and give you the row number, then it will find the Column that contains "Color" and return the Column number, with those two numbers Index will return your color.

Finding and obtaining the difference between two columns

I have two columns. Each column has tens of thousands of values. I need to find the difference between them and print the difference in some cells. I read similar questions, but they are not enough for my question, highlighting the different cells is not enogh for me because it would be very tiring to look at tens of thousands of cell by searching highlighted cells. Thus, i need to obtain the values.
Example:
Column1 Column2
John Jennifer
Mary Washington
Joe John
Michael Texas
Houston Newyork
Texas Mary
Values existing in col1 but not col2 : Joe, Michael, Houston
Values existing in col1 but not col2 : Jennifer, Washington, New York
Algorithmically, i need to check each row of column1 whether it exists in Column2, if the row does not exist in Column2, the value is taken.
Similarly, i need to check each row of column2 whether it exists in Column1, if the row does not exist in Column1, the value is taken.
Thanks
Old: If this is a once-off i'd make a backup then mark the area of the two columns and "remove duplicates" which is a button on the DATA command bar.
You would be left with unique records only, which is what I understand you want.
Edit: If you want to completely remove duplicate values then: Assuming that col1 is "A" and col2 is "B" then this formula only shows the record if it is in A but not in B. You can make a similar one for B not in A. In my example I made two columns C, D for the unique values. Then filter the list on these being "not nothing", and you have a set of unique records.
Current formula is for A2 cell - in my example placed in C2.
=IF(ISERROR(MATCH(A2;B:B;0));A2;"")

Selecting a row in excel based on specific values in 2 columns,

Data roughly in the format
A B C
ID1 ID2 0.5
ID1 ID3 0.7
ID2 ID3 0.9
I want to create a correlation matrix (column C being the correlation between the IDs in A and B). It can definitely be done with a pivot table, though I have to use sum which could be risky if a duplicate existed since an error might not be apparent. Output format would be:
ID1 ID2 ID3
ID1 1 .5 .7
ID2 .5 1 .9
ID3 .7 .9 1
(the '1' is easily done with an =IF(B$2=$A3,1,0) and replacing 0 with the formula to find the correlation)
I basically want a match (col a= ID1 && col b = ID2). I suspect it could be done by concatenation, but I am not sure that is a great solution? Match/Vlookup etc only return the first match [in that column], which is no good to me. Ode to a 'where' clause I guess?
My searches did not reveal any usuable help, I have already calculated the correlation and am putting it into excel from SQL. So yeah, any ideas would be super, a pivot table being a last resort.
Thanks.
Assuming your source data range is on Sheet1, from A1 to C3 and your results range is on Sheet2, from A1 to D4.
You can put this formula on B2:
=SUMPRODUCT((Sheet1!$A$1:$A$3=Sheet2!B$1)*(Sheet1!$B$1:$B$3=Sheet2!$A2)*Sheet1!$C$1:$C$3)
and then, drag and drop this formula on the whole range.
Why don't you create a third column that combines the values from columns A and B using =A1&B1 and then do vlookup on that value:
A B C D
ID1 ID2 ID1ID2 0.5
ID1 ID3 ID1ID3 0.7
ID2 ID3 ID2ID3 0.9

copy rows after each other excel

I have a Microsoft excell file: I want to copy 2 rows and add these to the previous row (the first row). I give an example:
row1 -> 0027448 R 3 1 203,45 22375 EDS001 name1 name1 eds1
row2 -> 0027448 R 3 1 203,45 22375 EDS001 name2 name2 eds1
row3 -> 0027448 R 3 1 203,45 22375 EDS001 name3 name3 eds1
My question is: how can I copy row1, row2 and row3 after each other:
course without manually copying. but through formulas!
row1 ... row2 ... row3 ....
This program made ​​me more or less a good solution. Better solutions are still welcome!
I got the Excel plugin from this website: ASAP Utilities
How can I copy row1, row2 and row3 after each other? Of course without manually copying.
If you need copying after each other vertically, row by row, that seems to be simple.
In the very left cell of town you can just paste link to the very first cell of row1 (like: =A1).
Stretch it horizontally, then stretch the whole row1 (with formulas) vertically to the bottom.
This will copy itself, so rows 4,5,6 will copy rows 1,2,3.
Rows 7,8,9 will copy rows 4,5,6 (and again, it will be equal to rows 1,2,3) and so on as long as you need.

Resources