 # Comparing columns and returning value [Solved/Closed]

-
kittu -
Hello,

I have an Excel spreadsheet where I want to compare values between two columns and return the value from another column.

EX:

```Column: A     B     C     D
1     1     Z      Forumula: return value
1     2     Y
1     3     X
1     4     W
2     5     V
2     6     U
2     7     T
3     8     S
3     9     R ```

What I would like to happen in column D is for it to look at what is in column A, find the matching value in column B, and return the value listed in C. i.e. for any value of '1' in column A, I would want column D to display 'Z', for any value of '2' in column A, I would want column D to display 'Y', for any value of '3' in column A, I would want column D to display 'X', etc.

Could someone help?

Thanks!
Related:

## 12 replies

Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Hi

Use the formula (in cell D1) =VLOOKUP(A1,\$B\$1:\$C\$9,2,FALSE)
Do let me know If it helps...
Thanks so much, the VLOOKUP formula worked! I wouldn't have figured it out on my own... I think I understand it, but not sure what the '2' does in the 2,FALSE part of the formula. If you'd like to explain, that'd be great, if not, you've helped enough and saved me hours of work!

Thanks!
Thanks folks, it really is helpful...
Keep up the good work
OMG this formula has just saved me from tearing my hair out, THANK YOU!
ballin out - very simple formula, thank you for helping
Thanks
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Hi

Use in Cell D1 the formula, =VLOOKUP(A1,\$B\$1:\$C\$9,2,FALSE)

Do let me know If it helps...
a1 418
a2 817
a3 525
a4 635
a5 254
a6 852
a7 969
a8 857
a9 568
a10 963
a11 254

when I put a9 in column A1 , COLUMN D1 should return the value 568, when I put a5 in colum A1, then column Di should return the value 254, like that...can u assist ?
=IF(D6=1,"Z",IF(D6=2,"Y",IF(D6=3,"X",FALSE)))

A B C D
1 1 Z Z
1 2 Y Z
1 3 X Z
1 4 W Z
2 5 V Y
2 6 U Y
2 7 T Y
3 8 S X
3 9 R X
Bang on!! This is exactly what i was looking for. Thank you so much
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010
215
Put this formula =CHAR(91-A1) in Cell D1 and drag it down. It will give you Z to A for the values of 1 to 26.
D1==CHAR(91-A1)

C1==CHAR(91-b1)
Hi,

I've been driving myself crazy on excel trying to figure out a formula to calculate the responses for a test. Here's what I need it to do:

If the value in cell A2 matches the value in cell B2, I need it to display a 1.
If the value in cell A2 does NOT match the value in cell B2 and is not blank, I need it to subtract .25 or display -.25 (whichever).
If there is no value in cell A2 (if it's blank), I need it to display 0.

I can't find this anywhere because nothing explains how to pick between 3 inputs and then return one of 3 values.

Hope you can help.
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
761
Seems to be a totally different question. It is better if you start a new thread
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Hi

Use =VLOOKUP(A1,\$B\$1:\$C\$9,2,FALSE)
in cell D1 and copy downwards

Do let me know If it helps...
Hi,
This is my dilema , I obviously am missing something here

Old record New record

1 1
4 4
3 5
5 6
7 8
8 9

How do I get Column C to give me :
1. If the same values in A and B to show the same in C using False AND
2. If the values are not the same then #N/A in Column C

I seem to be challenged trying to use one vlookup formula to compare all the values of Column A and B to display the result in C.
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010
215 > Natdev
Suppose your data is in Row 1 then use this formula and drag it down ........ it will see A1 values in whole column of B and if find then give you the value ......

=VLOOKUP(A1,\$B\$1:\$B\$6,1,FALSE)

this helped me a lot. thanks mubashir aziz! :)
Hello. Here is my scenario/problem.

I want a formula that will populate column D with the results of the following. It will find anything in column A that also appears in column B. If it appears in column B it will display the associated value from column C.

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
761
I think you need an IF statement

=IF(condition, true action, false action)

Lets say we are working in row 2

then in D2, you can write

=IF(A2=B2, C2, "")

Which says that if a2 is same as b2, then show value of c2 else just show blank ("")
garbage
Hello all,

Assume that in A1:C5 I have the following table:
A B C
1 1 Low
2 1 Low Mod
3 1 Moderate
4 1 Mod High
5 1 High

And I have in Row 10 the following:

Row 10: A10=3 and B10=1

What sort of formula do I need to create in C10 that would look up the value from the table above (A1:C5) and would match the value of A10 to the relevant value in column A, and does the same for the value in B10 to the relevant value in column B so that the outcome is the corresponding value in column C... C3 = "Moderate"

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
761
=INDIRECT("C" & SUMPRODUCT((A1:A6=A10) * (B1:B6=B10) * ROW(B1:B6)))
Hello,

Please help me, what is the formula to get the value from column B that is not in column A?

I have compare new data I want to find out what is the new value that has been added to B that is not

in A. I know how to use vlookup basic but it's a bit complicated since it will only show 1 result as well as with

the exact formula it will only show false and I still have to dig in the values one-by one to get the value that

doesn't really have a matching value in the spreadsheet.
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010
215
Suppose you are compaing Col. B with Col A. now write this formula in C1 and drag it down ... hope it will help you ......

`=IF(ISERROR(VLOOKUP(B1,\$A\$1:\$A\$8,1,FALSE)),"New Data","")`

>
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010

Dear brother

=IF(ISERROR(VLOOKUP(B1,\$A\$1:\$A\$8,1,FALSE)),"New Data","")

is a very nice formula which provide u. I use it same u ask and I find correct value which I want.

keep it up to share these types of information

May Allah Help u

Thanks & Regards

Shakee Ahmed
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010
215
Although you question is quite confusing because in your title you are asking to compare two column which means you want to compare but in your example you are talking about A & B Separately.

Anyway, Copy below formula in Cell D1 and it will give you the values of 1 to 26 from Z to A.

D1=CHAR(91-A1)

For

C1=CHAR(91-B1)

For any confusion don't hesitate to consult with me.........
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010
215
Put this formula in Cell D1 and drag it down. It will give you Z to A for the values of 1 to 26.

D1=CHAR(91-A1) and drag it down ......

Thanks for the response Mubashir - I used the numbers/alphabet to illustrate my example, I actually have words/amts etc. that I was trying to match up, I should have been clearer on that - good formula to know though!
Posts
191
Registration date
Sunday April 12, 2009
Status
Member
Last seen
February 16, 2010
215
This is the syntax of Vlookup .... in your formula 2 is the nth column in Range .... If you will not False in the formula then it will return you closest match and will not return any error ......

VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)

Lookup_value is the value to be found in the first column of the array. Lookup_value can be a value, a reference, or a text string.

Table_array is the table of information in which data is looked up. Use a reference to a range or a range name, such as Database or List.

If range_lookup is TRUE, the values in the first column of table_array must be placed in ascending order: ..., -2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise VLOOKUP may not give the correct value. If range_lookup is FALSE, table_array does not need to be sorted.

You can put the values in ascending order by choosing the Sort command from the Data menu and selecting Ascending.

The values in the first column of table_array can be text, numbers, or logical values.

Uppercase and lowercase text are equivalent.

Hi all,

Is there a way to compare the contents of a cell with a different cell using TRUE/FALSE results?

For instance,
cell A1 contains: Jr3
comparing with
cell B1 contains: Jr3

cell C1 (the result cell) will show up TRUE

now what if I want to match the content of B1 with cell A1 which contains more than one value in it?
For instance,
cell A1: Jr3, Jr4
comparing with
cell B1 containing Jr3

cell C1 should show up TRUE (since cell A1 does have Jr3 as its value separated by a comma)

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
761
You can use find to do that
What if the compared cell is a merged cell. Example, comparing the values in column C with the merged cell values in Column A, expecting the result of the values from column B.

A B C D(Result)
1 x 1
y 2
2 z 3
3 c 4 