Matthew Bruce
New Member
- Joined
- Jan 31, 2014
- Messages
- 9
I need to create a "Calculator", which takes a date/time entered by the user, and adds a certain time (up to 100hours) based on criteria, giving a another date/time. To complicate matters, I need to exclude non business hours and weekends for some criteria, but not others.
Example
If Criteria 1=Green, Criteria 2 = 1 or 2 or 3
If 1, + 08:00 (24/7)
If Criteria 1 = Red, Criteria 2 = A or B or C
If A, +08:00 exluded non business hours (17:30 - 09:00) and weekends
User Entry....................... Criteria 1 ..................Criteria 2 ..........Calculated Time
12/03/14 12:00................ Red .........................A ......................= 13/03/14 11:30
12/03/14 12:00................ Green ......................1 ......................= 12/03/14 20:00
All I have so far is a Networkdays formula that calculates the time between two dates excluding 17:30-9:00 and weekends.
=(NETWORKDAYS(A4, C4)-1)*("17:30"-"09:00")+IF(NETWORKDAYS(C4,C4),MEDIAN(MOD(C4,1),"17:30","09:00"),"17:00")-MEDIAN(NETWORKDAYS(A4,A4)*MOD(A4,1),"17:30","09:00")
I don't mind if its complicated or long winded, just need it to work. VBA is probably beyond me but will give it a go.
Thanks.
Example
If Criteria 1=Green, Criteria 2 = 1 or 2 or 3
If 1, + 08:00 (24/7)
If Criteria 1 = Red, Criteria 2 = A or B or C
If A, +08:00 exluded non business hours (17:30 - 09:00) and weekends
User Entry....................... Criteria 1 ..................Criteria 2 ..........Calculated Time
12/03/14 12:00................ Red .........................A ......................= 13/03/14 11:30
12/03/14 12:00................ Green ......................1 ......................= 12/03/14 20:00
All I have so far is a Networkdays formula that calculates the time between two dates excluding 17:30-9:00 and weekends.
=(NETWORKDAYS(A4, C4)-1)*("17:30"-"09:00")+IF(NETWORKDAYS(C4,C4),MEDIAN(MOD(C4,1),"17:30","09:00"),"17:00")-MEDIAN(NETWORKDAYS(A4,A4)*MOD(A4,1),"17:30","09:00")
I don't mind if its complicated or long winded, just need it to work. VBA is probably beyond me but will give it a go.
Thanks.