2 columns containing numbers need to id any the same

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

Appreciate if in Excel, anyone can suggest how i treat this problem:

I've two columns of numbers (numerals?) up to 5 digits long, that can run to
many 1000s. in a third coumn i need to 'report' or flag that any ONE number
is in both of the columns.

I've tweaked and experimented with IF/THEN logic statements but it hasn't
worked.

Thanks for any advice

Pete
 
Hi Pete,

This macro reports all items that are in both columns

Sub CheckNumbers()
Dim i As Long
Dim iNextRow As Long

For i = 1 To Cells(Rows.Count, "B").End(xlUp).Row
If WorksheetFunction.CountIf(Range("A1:A5000"), Range("B" & i)) > 0
Then
iNextRow = iNextRow + 1
Cells(iNextRow, "C").Value = Cells(i, "B").Value
End If
Next i
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A quick way to "see" diferences is to use conditional formatting and make the cells show a different colour where figures match

----- Pete wrote: ----


Appreciate if in Excel, anyone can suggest how i treat this problem

I've two columns of numbers (numerals?) up to 5 digits long, that can run t
many 1000s. in a third coumn i need to 'report' or flag that any ONE numbe
is in both of the columns

I've tweaked and experimented with IF/THEN logic statements but it hasn'
worked

Thanks for any advic

Pet
 

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