help in if

do0ot

New Member
Joined
Mar 31, 2011
Messages
14
hi guys
im creating a parking system in ms acess but i need a help in the querys plz
ok first let me explain
i have a field called USERID , arrival time , leave time , fees

i want a code to write that : IF the USERID start with "IN" in the fees will type free
else
if the time between arrival and leave more than 1 hour in the fees will write 1$ it is possible to do it ?
plz help me ASAP i have a proejct to submite it
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Fees: iif([userid] like "IN*","FREE",iif(datediff("h",[arrival time],[leave time])>1,"$1","Conditions not met"))

I've not tested this. Arrival time and leave time may need to be switched. You didn't say what needed to be done if the data doesn't meet the criteria you described, hence the "Conditions not met".

Phil...
 
Upvote 0
I've not tested this. Arrival time and leave time may need to be switched. You didn't say what needed to be done if the data doesn't meet the criteria you described, hence the "Conditions not met".

Phil...

first of all thnx bro for helping me
about the arrival time and leave time really i didnt get the concept can u help me more if u dont mind
for example my table is now like that

USERID Arrival LEave Fess
IN003 10:00:00 AM 12:00:00 AM Free
ST004 8:00:00 AM 10:00:00 AM 2 Dolar

IN=Refeer to instructor so the fees will be wrttin on it free
ST=refeer to student and he have park for 2 hours so the fees should be 2 Dolar

i really get confused on how doing that :S
 
Last edited:
Upvote 0
Fees: iif([userid] like "IN*","FREE",iif(datediff("h",[arrival time],[leave time])>=1,"$" & datediff("h",[arrival time],[leave time])*1,"Conditions not met"))
Thanks for providing more information. This expression will now calculate an hourly rate. What do you charge students who use your space for less than 1 hour?
 
Last edited:
Upvote 0
Ok.
Fees: iif([userid] like "IN*","FREE",iif(datediff("h",[arrival time],[leave time])>=1,"$" & datediff("h",[arrival time],[leave time])*1,"FREE"))
This should do it for you then.
 
Upvote 0
ok bro its working but the problem is he asking my to enter the arrrival time and leaving time and i already entered this record befor so it have only to calculate it :D
 
Upvote 0
frist feild Arrival and the second Leave
the record im typing it manually so just to have to calculate the hourse and than type the fees
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

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