Checking a column of data against another set and assign 1 next to it

dilla1988

New Member
Joined
Sep 4, 2014
Messages
22
Hey guys,

The best excel help forum so far. For a graduate employee like me this has been huge help.

anyway i have a new situation.

i have a column 1 with values as follows:

12594455
12594480
12594517
12594534

and then another, column 2 :
12594455
12594455
12594455
12594455
12594455
12594455
12594455
12594455
12594455
12594480
12594480
12594517
12594517
12594517
12594517
12594517
12594534
12594534
12594534
etc;

now i want to find if column 2 matches with column 1, i want to put "1" next to column 2 entries. Mind that there will be different values within column 2 so they would have "0" next to it. whole end point of this is for me to filter out the "1" and copy the headers.

thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Is this what you're looking for?


Excel 2010
ABC
1Column 1Column 2Match?
212594455125944551
312594480125944551
412594517125944551
512594534125944551
6125944551
7125944551
8125944551
9125944551
10125944551
11125944780
12125944801
13125944801
14125945171
15125945171
16125945171
17125945171
18125945171
19125945341
20125945341
21125945341
Sheet5
Cell Formulas
RangeFormula
C2=IFERROR(MATCH(B2,$A$2:$A$999,0)^0,0)
 
Upvote 0
why in the IF statement value_if_true = 0 when it should be other way round?

I used this and it seems to give results. but i'm confused between ISERROR and IF
 
Upvote 0
why in the IF statement value_if_true = 0 when it should be other way round?

I used this and it seems to give results. but i'm confused between ISERROR and IF

The formula you posted is checking for a match in column 1. If the match function returns an error, meaning there is NO MATCH, the IF function will return a 0 as text ("0"). Otherwise, if the match function returns a number, meaning it found a match, the IF function will return a 1 as text ("1").
 
Upvote 0
Hey Ben,

That's precisely I want!

how does it differ to =IF(ISERROR(MATCH(F1,$A$1:$A$18,0)),"0","1") ??
 
Upvote 0
If you mean which one is better to use, I'm not sure. The one I posted seems a little simpler to me, but they are fairly similar.

The only other difference is that your formula is returning 0s or 1s as text and mine is returning 0s and 1s as numbers (which can be summed or some other math operation). This may or may not matter to you, but can be easily fixed by adjusting your formula as Jim885 suggested above:

This should also work;
Code:
=IF(ISERROR(MATCH(F1,$A$1:$A$18,0)),0,1)
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top