LTDragon07

New Member
Joined
Mar 13, 2015
Messages
8
I have a query in which I'm converting number date "20150415" to "15-Apr-15" and then find the difference between 2 dates. first and last dates
I'm using the following expressions;
FLabour is a group by "Min" which is searching a Linked ODBC table.

Fdate: IIf(Len([FLabour])=8,CDate(Mid([FLabour],5,2) & "/" & Right([FLabour],2) & "/" & Left([FLabour],4)))
which converts"20150415" to "15-Apr-15"

TotalDays: DateDiff("d",[Fdate],[Ldate])


The problem I'm running into, is that some of the fields in [FLabour] are blank and the enter parameter value box comes up. Is there a way to skip this entry as I will never what to enter a value.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
maybe test that the field has numeric values before running the statement
 
Upvote 0
Total Days may be one less than you expect. If the first date is the same as the last date you will get 0. Do you expect 0 or 1? If you want / expect 1, then

TotalDays: DateDiff("d",[Fdate],[Ldate]) +1
 
Upvote 0
I think I found the problem, I using the Total to do some min max, I had to just query the query.
Few off fix for now.
 
Upvote 0

Forum statistics

Threads
1,215,999
Messages
6,128,193
Members
449,431
Latest member
Taekwon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top