How to forecast pick-up date based on multiple conditions?

xlmaniac

Well-known Member
Joined
Jul 2, 2009
Messages
528
Office Version
  1. 2010
Platform
  1. Windows
Dear All,
We dispatch material via courier from our DC based on the orders received from the customers through internet. The DC operates from Monday to Saturday(Sunday being weekly off). Courier company also picks up material from our DC only from Monday to Saturday(Sunday being weekly off).
Apart from weekly off on Sunday, there are certain HOLIDAYs for both DC & courier company when the dispatch is not made.
There is a cut off time for the order processing for a particular day. If the customer has placed the order on or before 16PM then the dispatch will be made on the same day or else it will be dispatched on the next working day.
I am looking for a formula which can forecast the proposed pick-up date from the DC based on the following conditions:-
1)Formula to check whether the order is within the cut-off-time or not.
2)Formula to first check the list of weekly Offs(SUNNDAYS).
3)Formula then to check the HOLIDAY list of DC & HOLIDAY list of courier company.
Post checking the above conditions the formula needs to forecast a PICK-UP date accordingly.
I am providing a sample data with the desired result.
Would be of great help if somebody helps out with a solution.
Excel Workbook
ABCDEFGH
1Customer Order DateCustomer Order TimeProposed Dispatch Date(Desired Result)RemarksList Of Weekly Offs(Both DC & Courier)DC HolidaysCourier Holidays
24-Apr14:204-AprOrder time is before the Cut-Off Time of 16PM and hence the dispatch will be done on 4th April.1-Apr6-Apr6-Apr
35-Apr13:357-Apr6th April is DC HOLIDAY & hence the dispatch date is 7th April.8-Apr14-Apr13-Apr
47-Apr12:109-Apr8th April is SUNDAY & hence the dispatch is on 9th April.15-Apr16-Apr
512-Apr11:4017-Apr13th/14th/16th is HOLIDAY & 15th is SUNDAY & hence the dispatch is on 17th April.22-Apr
615-Apr22:5017-Apr15th is SUNDAY & 16th is HOLIDAY & hence the dispatch will be on 17th April.29-Apr
720-Apr20:4021-AprOrder time is after the Cut-Off Time of 16PM and hence the dispatch will be done on 21st April.
821-Apr23:1523-AprOrder time is after the Cut-Off Time of 16PM & 22nd April is SUNDAY and hence the dispatch will be done on 23rd April.
Sheet3
 
Hi Cyrilbrd,
Sorry to bother you again.
My mistake that I over-looked the result for the 5th scenario suggested by you.
This is for 24th Dec(Order Time-22:50).The pick-up date needs to be 26th Dec and not 27th Dec(since 25th Dec is holiday).
Thanks again
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Ok,
I would like to suggest the simplest approach.
Create a database DB where the dates of interest will be placed.
In A1 "status"
In B1 "date"
in C1 "newdate"
and from B2 to B367 the complete dates of 2012 starting 1st of Jan in B2 till 31st of Dec in B367.
Not much to this yet...
In Column A, just write "VL" in front of each date that will be either a sunday, or a national Holiday and other when you are sure that either your company or the Carrier would not work. that was provided by you. No worries I prepared the list for you...

In Column C we will place the date that should appear if ever the date in B is a Holiday.

This allows extreme flexibility, your government or boss or carrier may decide in advance that a "supposed to be working day" will be a day Off, just just have to add "VL" in column A corresponding to the said date and correct the value in Column C and the formula will do the rest.

In order to simply the ranges I used Named Ranges. Column B is "date" and Column C is "newdate".

In cell D1 type: "COT is"
in Cell E1 type: "16:30" (4:30:00 PM) and Named Range as "COT"

Now go to the Worksheet containing your data.
Column A is "Customer Order Date" right? with the dates below.
Column B is "Customer Order Time" with the time.
Column C is "Proposed Dispatch Date".
Cell C2 is:
Code:
=IF(B2>COT,INDEX(newdate,MATCH(A2+1,date,0)),INDEX(newdate,MATCH(A2,date,0)))

but I suggest using:
Code:
=IF(ISNA(IF(B2>COT,INDEX(newdate,MATCH(A2+1,date,0)),INDEX(newdate,MATCH(A2,date,0)))),"",IF(B2>COT,INDEX(newdate,MATCH(A2+1,date,0)),INDEX(newdate,MATCH(A2,date,0))))
because it will return a blank in lieu of a #N/A when there is no date in column A.

Copy down till needed.

please advise if ok.

link to your file.
 
Upvote 0
Hi Cyrilbrd,
Sorry to bother you again.
My mistake that I over-looked the result for the 5th scenario suggested by you.
This is for 24th Dec(Order Time-22:50).The pick-up date needs to be 26th Dec and not 27th Dec(since 25th Dec is holiday).
Thanks again

Noted but as per the list you gave me your Courrier will be on leave on the 26th...

Holiday List-DC Holiday List-Courier
26-Jan 26-Dec
8-Mar 20-Feb
6-Apr 8-Mar
1-May 9-Mar
15-Aug 13-Apr
20-Aug 14-Apr
2-Oct 10-Aug
22-Oct 15-Aug
23-Oct 2-Oct
24-Oct 24-Oct
13-Nov 27-Oct
25-Dec 13-Nov
14-Nov

So the next open day is 27th of December.
Right?
 
Upvote 0
xlmaniac, if the date "26 - Dec" in "Holiday List-Courier" is a typo, and should have been "26 - jan".

Then just change DB Cell A362 and delete the VL, the cell won't be highlighted, then in C361 and C362 change "27-Dec" into "26-Dec".
That will be all.

so it will show:
HTML:
24-Dec	11:40	24-Dec
24-Dec	22:50	26-Dec

Please advise if this is correct. (do you need me to send the new file with those corrections?)

Hi XLSM, your approach is quite good but being lazy (one of my qualities...;)) I opted for a faster and less demanding solution. The disadvantage of my solution is the existence of the DB (database), however DB are quite the simplest solution and allow users to review their bases and modify them whenever needed without having to change the formulas.

Cheers!.
 
Upvote 0
Cyrilbrd,

I agree that using a db makes it easier for the user to 'maintain' this solution. Especially if the user is not the one writing the functions that i had used in my solution.

I appreciate you comparing our solutions and listing the pros and the cons.

Cheers!
 
Upvote 0
Hi Cyrilbrd,
I am really overwhelmed and touched with your empathy towards the solution of my problem.:):):)

I can not only say thank you to you because what you have done is really a WOW factor to me and I will be ever grateful & indebted to you for this amazing & overwhelming solution that you have provided.

Once again I would like to express my sincere gratitude to you for extending all the support & help sparing your valuable time for me.
You are right that 26th DEcember was a typo error.

Anyway I have corrected the file as advised by you.

I realy feel proud & priviledged to be a part of this great fraternity in MR.EXCEL and I also cherish the learning that I learn from all the EXCEL GURUS like you.

With Warm Regards
 
Upvote 0
xlmaniac...

Cool,
Glad it worked for you! :biggrin:

Let us know if you have other puzzles to solve.
Bro, I am not a GURU, XLSM's solution is quite cool too, let's just say that I we are all learning from each others!

Cheers.
(y)
 
Upvote 0
Hi Cyrilbrd,
It is your magnanimity and modesty that you are claimimg yourself to be a learner.:):)
Mr excel rocks and I am proud to have been associated with people like you who has got the empathy towards the solution of other's problem.
I will surely let you know if I come across any problem that is beyond my capabilities to solve.:(
Anyway my best wishes to you and I am sure that you will continue helping excel lovers like us.:cool:
Thanks once again....
 
Upvote 0

Forum statistics

Threads
1,216,825
Messages
6,132,930
Members
449,768
Latest member
LouBa

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