compare column1 with column2

  • Thread starter Thread starter myguess21
  • Start date Start date
M

myguess21

Hi,

How do i compare column1 with column2 and output in column3.

ex.

column1 column2 output

test1 test4 test1
test2 test6 test2
test4 test1 test4
test6 test2 test6

Thanks for you help.
 
You have not told use what criterion to use in the output column.
Do you want the largest of the two values?
either =MAX(A1:B1) or IF(A1>B1,A1,B1)
copy down the column
best wishes
 
Thanks for quick response.

No this is string. Just want to search the value from column 2 i
column1 if found out put in column 3
 
Some formulas to try:
=IF(A1=B1,A1,"")
=IF(FIND(B1,A1),A1,"")
=IF(SEARCH(B1,A1),A1,"")
 
Is this is what you meant? (Search col A for each element in col B?)

=IF(MATCH(B1,A:A,0),B1,"")

red blue blue
green white white
blue yellow #N/A
black black black
white blue blue

but in both cases how do you get rid of "#N/A" when there is no match?

Tom Ogilvy said:
in C1
=if(match(B1,A:A,0),A1,"")

then drag fill down the column.
 
Should actually be:

=if(isnumber(match(B1,A:A,0)),A1,"")

--
Regards,
Tom Ogilvy



Tom Ogilvy said:
in C1
=if(match(B1,A:A,0),A1,"")

then drag fill down the column.
 
Not if you look at the OP's example. It is as I wrote it and I posted a
correction to account for the N/A.
 
The original example seems a little unusual. Maybe it's a VLookup problem:

=VLOOKUP(B1,A:B,2,FALSE)

test1 test4 test3
test2 test6 test5
test4 test3 test1
test6 test5 #N/A
test3 test1 test4


Tom Ogilvy said:
in C1
=if(match(B1,A:A,0),A1,"")

then drag fill down the column.
 
Yes. this is what i need to do.

Thanks a lot.


Is this is what you meant? (Search col A for each element in col B?)

=IF(MATCH(B1,A:A,0),B1,"")

red blue blue
green white white
blue yellow #N/A
black black black
white blue blue

but in both cases how do you get rid of "#N/A" when there is no match?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top