Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default How to compare values in different columns and indicate outcome

Hello,

I am trying to develop a spreadsheet to track implementation of
patches/service packs on different machines. I have 2 columns (A & B)
representing different machines. Each column contains a KB or Q article
number (ex: KB823803; Q147222). Each column is sorted. I need to be able
to compare the entries on each row. If they are the same, indicate by either:

1. Change the backgroun color of the two cells to green if they are the
same.
2. Add "same" in the C column, same row as the row being compared.
3. Any other simply and obvious indication that the 2 values being compared
are the same.

If they are different, basically do the same thing, just indicate they are
different.

Can anyone suggest how I can quickly accomplish this? I am somewhat
familiar with VBscripting if that helps.

TIA,
Rich
  #2   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default How to compare values in different columns and indicate outcome

Hi Rich

Assuming two columns of data (A and B),already sorted with no breaks.

Try this


Dim task As Range
Range("a1").Select
Range(Selection, Selection.End(xlDown)).Select
Set task = Selection

For Each cell In task
cell.Interior.ColorIndex = 0
cell.Offset(0, 1).Interior.ColorIndex = 0
If cell.Value = cell.Offset(0, 1).Value Then
cell.Offset(0, 2).Value = "Same"
Else: cell.Offset(0, 2).Value = "Different"
End If
If cell.Value = cell.Offset(0, 1).Value Then
cell.Interior.ColorIndex = 4
If cell.Value = cell.Offset(0, 1).Value Then cell.Offset(0,
1).Interior.ColorIndex = 4


Next

Range("a1").Select

"rich" wrote in message
...
Hello,

I am trying to develop a spreadsheet to track implementation of
patches/service packs on different machines. I have 2 columns (A & B)
representing different machines. Each column contains a KB or Q article
number (ex: KB823803; Q147222). Each column is sorted. I need to be
able
to compare the entries on each row. If they are the same, indicate by
either:

1. Change the backgroun color of the two cells to green if they are the
same.
2. Add "same" in the C column, same row as the row being compared.
3. Any other simply and obvious indication that the 2 values being
compared
are the same.

If they are different, basically do the same thing, just indicate they are
different.

Can anyone suggest how I can quickly accomplish this? I am somewhat
familiar with VBscripting if that helps.

TIA,
Rich



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare values of two columns Diane Excel Worksheet Functions 5 April 17th 08 08:26 PM
Compare values in different columns JJM0926 Excel Discussion (Misc queries) 2 June 27th 07 09:34 PM
I want to compare the values in two columns Dr. Darrell Excel Discussion (Misc queries) 4 September 14th 06 02:07 AM
Compare values in columns cpetta New Users to Excel 5 April 2nd 05 03:24 PM
Excel Compare values in columns & display missing values in a new cpetta Excel Discussion (Misc queries) 1 April 2nd 05 05:51 AM


All times are GMT +1. The time now is 03:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"