ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Matching Column Entries (https://www.excelbanter.com/excel-programming/306411-matching-column-entries.html)

kiza[_15_]

Matching Column Entries
 
Hi,

I have two columns, A and B, which both contain numerical information
Column A is the master column with the correct information in. Column
is a copy of Column A however, not all of the information from Column
is in Column B. I am therefore trying to identifiy which items o
numerical information is in Column A but not Column B.

I have a macro which will loop through but there is one line in ther
which I do not know how to change in order for it to identify whic
items of numerical information are not in Column B.

The two columns do not match up in terms of size so I cannot sort the
and offset the macro. I am looking at a cell in Column A to be matche
up with a cell in Column B which I believe needs to be a range.

I have pasted the code below and if any one could assist me, I woul
appreciate it.

Sub Cell_Colour()
'
Dim rwIndex, ColIndex
'
For ColIndex = 1 To 2 ' ColIndex means Columns 1 To 2
rwIndex = 2 ' rwIndex means maco starts from Row 2
'
Sheets("Sheet2").Select
Do Until Range("A" & rwIndex) = ""
Cells(rwIndex, ColIndex).Select
'
If Cells(rwIndex, ColIndex).Value = Cells(rwIndex - 1, ColIndex).Valu
Then
Selection.Interior.ColorIndex = 35
End If
rwIndex = rwIndex + 1
Loop
ColIndex = ColIndex + 1
Next ColIndex
End Sub

The line which I am having problems with is:
If Cells(rwIndex, ColIndex).Value = Cells(rwIndex - 1, ColIndex).Valu
Then

Perhaps Column B needs to be named but this is where I am struggling.

Any help would be appreciated.
Kiz

--
Message posted from http://www.ExcelForum.com


Bernie Deitrick

Matching Column Entries
 
Kiza,

No need for a macro. In Cell C1, use the formula

=IF(ISERROR(MATCH(A1,B:B,FALSE)),"In Column A, but not in Column B","")

And copy down to match your data in column A.

HTH,
Bernie
MS Excel MVP

"kiza " wrote in message
...
Hi,

I have two columns, A and B, which both contain numerical information.
Column A is the master column with the correct information in. Column B
is a copy of Column A however, not all of the information from Column A
is in Column B. I am therefore trying to identifiy which items of
numerical information is in Column A but not Column B.

I have a macro which will loop through but there is one line in there
which I do not know how to change in order for it to identify which
items of numerical information are not in Column B.

The two columns do not match up in terms of size so I cannot sort them
and offset the macro. I am looking at a cell in Column A to be matched
up with a cell in Column B which I believe needs to be a range.

I have pasted the code below and if any one could assist me, I would
appreciate it.

Sub Cell_Colour()
'
Dim rwIndex, ColIndex
'
For ColIndex = 1 To 2 ' ColIndex means Columns 1 To 2
rwIndex = 2 ' rwIndex means maco starts from Row 2
'
Sheets("Sheet2").Select
Do Until Range("A" & rwIndex) = ""
Cells(rwIndex, ColIndex).Select
'
If Cells(rwIndex, ColIndex).Value = Cells(rwIndex - 1, ColIndex).Value
Then
Selection.Interior.ColorIndex = 35
End If
rwIndex = rwIndex + 1
Loop
ColIndex = ColIndex + 1
Next ColIndex
End Sub

The line which I am having problems with is:
If Cells(rwIndex, ColIndex).Value = Cells(rwIndex - 1, ColIndex).Value
Then

Perhaps Column B needs to be named but this is where I am struggling.

Any help would be appreciated.
Kiza


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com