LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default VBA To Replace Duplicate Values with Zero (Complex)

Hi Trisha

i might be missing the point here, but if you added up the total hours for
the employee and then deducted the total of B*, C*, L* won't you get the
answer you want?

Cheers
JulieD

"Trisha B." wrote in message
...
We have a series of reports generated by an Access 2000 database in our
Payroll department which are sent to our Financial Services department.

The
report consists of several columns (only three of which concern me) and
10,000+ rows.

The columns a Column A the employee ID, Column B the pay code, and
Column C the number of hours worked at that pay code (there are no column
headings on the report).

The rows contain every payroll code for every employee for a given

two-week
pay period, and the number of hours worked at that code (e.g., "A" is

regular
day shift, "AE" is regular evening shift, "BE" is time and a half evening
shift, and it goes on).

The problem discovered yesterday is that overtime hours are being reported
twice, once as code AE and again as code BE. This also occurs with code

CE
(double time evening shift) as well as with K's (Inservice Days) and L's
(Inservice Overtime days).

The original developer of the database is not available and, for reasons I
won't go into here, the preference is that I adjust the report, not the
database. Hence my request for your help.

A very small representation of the worksheet would be very similar to this
(forgive the spacing, I know it never posts as written):

A B C
1 1122 AE 8.00
2 1122 AE 1.00
3 1122 BE 1.00
4 1122 JD 8.00
5 1234 AE 8.00
6 1234 CE 8.00
7 1234 AF 24.00
8 1234 SL 8.00
9 1234 SLE 8.00

What has been requested of me is:

1. To write code that will loop through each employee's recordset for the
given pay period,

2. Find any instances where the value of Column B = any B* (* indicating a
wildcard) or C*and, if found,

3. Also find the corresponding A* value whose hours worked (Column C) is
equal to the hours worked for the B* or C* value and convert the hours

that
relate to the matching A* to 0.00 then

4. Repeat the process if there is a K and L (K becomes the A, L the B*,

C*).

In the example above, in row 3, column B has a value of BE so they want me
to automate finding an A* pay code in the first four lines (as define the
employee ID) and also find the matching value in column C (so it would be
line 2, column B) and convert line 2 column C from 1.00 to 0.00.

After it does that, it would then go on to the next employee and repeat

the
process. Employees have different numbers of rows, some as few as three,
others in excess of 10, for each pay period with no breaks between rows.

We have approximately 10 old worksheets for this to be applied to and all
future worksheets will need the VBA code run against them.

Any assistance with this would be greatly appreciated.

Many thanks in advance



 
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
Replace Chart Values with Second Set of Values Brian Erhard Charts and Charting in Excel 1 November 29th 06 08:47 PM
array functions and complex element values frustrated Excel Worksheet Functions 0 March 13th 06 11:44 PM
averaging values according to (very) complex conditions liory Excel Programming 4 June 11th 04 11:38 AM
??Find and Replace Duplicate Cells JBL[_2_] Excel Programming 4 May 24th 04 09:58 PM
Complex identify values then cut/copy/paste query ian123[_47_] Excel Programming 2 January 25th 04 01:35 PM


All times are GMT +1. The time now is 01:24 PM.

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

About Us

"It's about Microsoft Excel"