This might not be very complicated for the Excel Gurus out there, but I have run out of ideas.
I have an Excel spreadsheet with the following information
Column D: Appointment Date
Column E: Appointment Time
Column F: Completion Date
Column G: Completion Time
Column H: Status
What I am trying to do is to create a formula to determine if Date and time in F & G are within a 3 hour window of date and time in D & E. If the date/time is outside that window indicate in column H whether it is early or late.
Please note that there is existing data in the tables and the data in columns are entered as numbers only and not formatted as time or date.
I would really appreciate if someone can help me with this. I spent whole day yesterday on this with no luck.
Many Thanks!
Last edited by Saajan; 05-11-2010 at 06:44 AM.
Try this
=IF(A2+B2>C2+D2+"03:00","Early",IF(A2+B2<C2+D2-"03:00","Late","On time"))
Thanks for your quick reply.
The date fields are entered in the right format, meaning dd/mm/yyyy. But the time fields are entered as general 1030, 915, etc. When I try changing this field to Time format, it just resets it to 00:00:00. I hope this provides a better understanding of the problem.
Your time and efforts are very much appreciated!
Last edited by Saajan; 05-11-2010 at 07:01 AM.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Lke mentioned earlier, not all time fields are entered as 4 digits.. Some are entered as 915, 230, etc.
For Bob Phillips formula to work, I thought it was essential for the time and date to be in the correct format.
Thanks!
Last edited by Saajan; 05-11-2010 at 07:17 AM.
Perhaps try the suggestion ?
It is assumed for PM times you would be entering as 1430 rather than 230 (else you have no means of distinguishing between am/pm)
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
May be I am doing it wrong... I highlight the 'H' column and insert the formula in the "fx" field and click on the green tick. Get the error "A value used in the formula is of the wrong data type."
Am I Missing something here?
Try this
=IF(D2+TEXT(E2,"00\:00")>F2+TEXT(G2,"00\:00")+"03:00","Early",IF(D2+TEXT(E2,"00\:00")<F2+TEXT(G2,"00 \:00")-"03:00","Late","On time"))
Thank you very much for that. It looks much better now.
I think we are nearly there. The only problem is that if the work is completed on the same day at an earlier time, it still displays it as "On Time" whereas if it is completed on an earlier date, it is displayed correctly. It is only checked against date and not time. Also, if the work is completed on time, I need this to be left blank. I only need "Early" or "Late" indicated.
Many Thanks.. You have been a great help!
Any suggestions?
Thanks!
My understanding is that there is a 3 hour window, so if it is completed 3 hours earlier than the appointment time that is not Early, but if it 3 hours 1 minute earlier, then that is early. The formula does exactly that.
Just delete the text -On Time- from the foirmula (but keep the quotes).
Sorry.. I should have been more specific.
Sometimes the work gets completed before the appointment time. Say for example, if the appointment time is 1400 on 15/05/2010 and the work gets completed at 1230 on the same day, then it should state as Early. But it is still showing up as "On Time".
With regards to the above example:
1359 = Early
1400 = On Time
1700 = On Time
1701 = Late
At present, it shows appointment time - 3hrs as early whereas it should show appointent time - 1 min as early.
I hope it makes better sense now.
Many Thanks for all your help!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks