#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Date Issue

So I'm trying to write a macro to count a number of records built on a shift
and output the data in a form similar to the one below.
Date Count
6/20/08 5
6/21/08 6

The problem i'm having is that our 2nd shift runs from 6:00 pm - 4:00 am and
I would like all of the data from that shift to be counted on the shift start
date. Ie, if i have a record on 6/21/08 2:15 AM that should be counted as
6/20/08.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,345
Default Date Issue

Assuming that your first shift runs from 8:00 Am to 6:00 PM, is is possible
to add six hours to the time to bring both shifts into the correct day?

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Brad" wrote in message
...
So I'm trying to write a macro to count a number of records built on a
shift
and output the data in a form similar to the one below.
Date Count
6/20/08 5
6/21/08 6

The problem i'm having is that our 2nd shift runs from 6:00 pm - 4:00 am
and
I would like all of the data from that shift to be counted on the shift
start
date. Ie, if i have a record on 6/21/08 2:15 AM that should be counted as
6/20/08.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Date Issue

1st shift runs from 6a - 4p

"Sandy Mann" wrote:

Assuming that your first shift runs from 8:00 Am to 6:00 PM, is is possible
to add six hours to the time to bring both shifts into the correct day?

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Brad" wrote in message
...
So I'm trying to write a macro to count a number of records built on a
shift
and output the data in a form similar to the one below.
Date Count
6/20/08 5
6/21/08 6

The problem i'm having is that our 2nd shift runs from 6:00 pm - 4:00 am
and
I would like all of the data from that shift to be counted on the shift
start
date. Ie, if i have a record on 6/21/08 2:15 AM that should be counted as
6/20/08.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Date Issue

Yup, that works. I actually set up an if then that would subtract 12 hrs if
the user selected 2nd shift. so the code looks like.

If enteredShift = "2" Then
rawDataDate = Cells(x, 12).Value - TimeSerial(12, 0, 0)
Else
rawDataDate = Cells(x, 12).Value
End If

"Sandy Mann" wrote:

Fine, adding six hours will still put both shifts in the day that you wan to
record the Records in.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Brad" wrote in message
...
1st shift runs from 6a - 4p

"Sandy Mann" wrote:

Assuming that your first shift runs from 8:00 Am to 6:00 PM, is is
possible
to add six hours to the time to bring both shifts into the correct day?

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Brad" wrote in message
...
So I'm trying to write a macro to count a number of records built on a
shift
and output the data in a form similar to the one below.
Date Count
6/20/08 5
6/21/08 6

The problem i'm having is that our 2nd shift runs from 6:00 pm - 4:00
am
and
I would like all of the data from that shift to be counted on the shift
start
date. Ie, if i have a record on 6/21/08 2:15 AM that should be counted
as
6/20/08.











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Date Issue

If the times are only between 6:00PM and 4:00AM, you could use this formula

=SUMPRODUCT(--(INT(Sheet2!$A$2:$A$200-"4:00:01")=Sheet3!A2))

--
__________________________________
HTH

Bob

"Brad" wrote in message
...
So I'm trying to write a macro to count a number of records built on a
shift
and output the data in a form similar to the one below.
Date Count
6/20/08 5
6/21/08 6

The problem i'm having is that our 2nd shift runs from 6:00 pm - 4:00 am
and
I would like all of the data from that shift to be counted on the shift
start
date. Ie, if i have a record on 6/21/08 2:15 AM that should be counted as
6/20/08.



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
Date Issue Vic09 Excel Discussion (Misc queries) 2 March 19th 09 10:44 PM
Date Issue Carlee Excel Programming 1 April 17th 07 06:14 PM
Date issue Jim Savage Excel Discussion (Misc queries) 7 February 9th 07 03:48 PM
DATE ISSUE! Joan Excel Worksheet Functions 2 June 15th 06 03:39 PM
date issue khennet Excel Programming 4 April 6th 04 05:46 PM


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

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"