Wednesday, August 11, 2010

Excel. How to find equal value and return connecting value?

This is my problem:





I have 3 columns. In the first I have a series of random numbers (column A). In column B, I have a longer list with numbers. In C I have even more numbers.





This is what I want to do:


I want to lookup if there is a match between A and B and IF there is, I want it to return the value in C next to it. So basically if A1=B1, return C1. But the problem is I want it to look in the WHOLE column for a match and not just one specific cell or value.





Example:


A B C


1 2 112


2 5 189


3 9 98


4 3 52





So I'm asking ';is there any matches between column A and B and if there is return the value in C.


So if it finds 2 as a match and brings me 112';.





I'm stuck and this would make my like a whole lot easier.Excel. How to find equal value and return connecting value?
Try this (data in cols A to C)


=IF(ISERROR(INDEX (C:C,MATCH(A1,B:B,0))) ,';';, INDEX(C:C,MATCH(A1,B:B,0)))Excel. How to find equal value and return connecting value?
Enter this in for D1:





=if(A1=B1, C1, ';';)





Then copy CELL D1 and paste it all the way down to your last row.
I'm not sure what you mean ';return c1';. However, if you want to set it to do the whole column, you can add ';$'; in front of the part you want to keep the same. So, to keep it in just that column, put the ';$'; in front of the letter for the column. This is the absolute refernce. So, it will stay in column A and B respectively, but the row will change.
You realize that in your example, C2 would display 189 as there is a match in B for the '2' in column A. Likewise for C3 and C4.





If you want to limit the action to column B, then C4 would also display 52 as there is a match in column A for the '3' in column B.





The formula for your question, as you state it, would be in C1:





=IF(COUNTIF(A$1:A$4,B1)=1,C1,';';)





If you want to check both columns against each other the formula would be:





=IF(OR(COUNTIF(A$1:A$4,B1)=1, COUNTIF(B$1:B$4,A1)=1),C1,';';)

No comments:

Post a Comment