MobileMobile | Continue

Excel Bar

Excel Bar

Your excel questions will be responsed by our excel experts within 24hrs.Our service is free.

 Forgot Pass?
 Register Now
Find
Hot Search: Vlookup Match VBA
View: 327|Reply: 6

Calculate out of service for a truck

[Copy link]

7

Topics

46

Posts

123

Integral

Conqueror

Rank: 3Rank: 3

Integral
123
Post on 2-9-2017 17:10:30 | All posts |Read mode
Hi All,
I am looking for a little help on this query expression below.
I want to calculate the time in days it takes for repairs to be carried out on a truck.
The Date_Down is the start of the time the truck was out of service.
I have another field named Date_Up which is when the truck is back in service, so the below query expression will calculate the number of days the truck is down.
So, how do I write the expression below to stop counting the number of days when I enter a date in Date_up field, I want to stop the time.
Delay_Duration: DateDiff('d',[Date_Down],Date())Thanks
Reply

Props Report

63

Topics

2079

Posts

4419

Integral

Forum Legend

Rank: 8Rank: 8

Integral
4419
Post on 2-9-2017 21:19:46 | All posts



Assuming you have the dates in different cells of your spreadsheet and using an example of:
Start Date  A1
End Date  B1
Total Days  C1
Paste in the formula bar for C1 :  =DATEDIF(A1, B1,d)
Format A1  B1 as :  dd-mmm-yy
Format C1 as number, no decimals
Reply Support Opposition

Props Report

63

Topics

2079

Posts

4419

Integral

Forum Legend

Rank: 8Rank: 8

Integral
4419
Post on 2-10-2017 00:09:36 | All posts



Assuming you have the dates in different cells of your spreadsheet and using an example of:
Start Date  A1
End Date  B1
Total Days  C1
Paste in the formula bar for C1 :  =DATEDIF(A1, B1,d)
Format A1  B1 as :  dd-mmm-yy
Format C1 as number, no decimals











Reply Support Opposition

Props Report

7

Topics

46

Posts

123

Integral

Conqueror

Rank: 3Rank: 3

Integral
123
 Author| Post on 2-10-2017 01:16:36 | All posts



Thanks for your reply, but this is an Access database not an Excel spreadsheet!!









Reply Support Opposition

Props Report

63

Topics

2079

Posts

4419

Integral

Forum Legend

Rank: 8Rank: 8

Integral
4419
Post on 2-10-2017 02:12:16 | All posts



Well darn !  Haven't used Access in years.
So sorry.
Reply Support Opposition

Props Report

63

Topics

2079

Posts

4419

Integral

Forum Legend

Rank: 8Rank: 8

Integral
4419
Post on 2-10-2017 16:06:22 | All posts



Well darn !  Haven't used Access in years.
So sorry.  









Reply Support Opposition

Props Report

3

Topics

561

Posts

1225

Integral

King

Rank: 6Rank: 6

Integral
1225
Post on 2-10-2017 16:51:28 | All posts



I'm not sure I have understood 100% but perhaps something like:
Delay_Duration: IIf([Date_Up] Is Not Null,DateDiff(d,[Date_Down],[Date_Up]),DateDiff(d,[Date_Down],Date()))
Reply Support Opposition

Props Report

Points policy of this forum

Archiver|Mobile|Small dark house|Contact us|Excel Bar

GMT-5, 9-24-2017 21:29 , Processed in 0.167780 second(s), 20 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

!fastreply! Top !return_list!