View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Mansfield John Mansfield is offline
external usenet poster
 
Posts: 235
Default Macro to Audit Two Columns of Data for Errors

I am trying to write a macro that would audit two columns of data for input
errors. A small data set appears below:

Code Fee
A5569 161
A5569 161
A5569 171
A2168 265
A2168 265
A2168 265
B3389 199
B3389 199

The macro should scan the first column for the same code. For each group of
same codes, it should average the corresponding values. If the average value
differs from the first value in the group, the macro should highlight the
codes and values.

For example, the macro would first scan column 1 for the first code in the
column - code A5569. It should then average the values corresponding with
that code (average of 161, 161, and 171 = 164.33). Because 164.33 differs
from 161 or 171, it should highlight code A5569 and the corresponding values
161, 161, and 171.

Once finished with that group, it should move to the next and scan code
A2168. It should average the values corresponding with that code (average of
265, 265, and 265 = 265). Because that average equals the values, there is
no input error and the macro should loop to the next code in the column -
B3389 and perform the same process again.

I'm stuck on how to analyze the data within a group of same codes and then,
once finished, move on to the next group.

Thanks for any help that can be provided.

--
John Mansfield