Problem calculating dates

Flash0220

Board Regular
Joined
May 2, 2002
Messages
104
Hello,


I'm having the following problem.

I have a (Excel Office 2003) spreadsheet, containing the following
information.

On a sheet called "Invoerscherm" (sorry, that's dutch) I have a column G
which contains the following formula :
=VERT.ZOEKEN(C168;Variabelen!$B$5:$E$20;2;ONWAAR)+E168

This formula calculates a date, on this date our company has to take
some kind of action such as calling a customer or sending them a letter.

But the problem is that sometimes the formula calculates a date which
is an official holliday like christmas, easter or other day's like that.

Since our company is closed on these dates the call or letter to be sent has to be done on a workday before that particular calculated date.

So if the calculated date is december 25th 2006 (Chrismas) then
the formula has to be modified in some way, that friday december 22nd 2006 is calculated instead of december 25th.

If the calculated date is december 26th 2006 (Also christmas), the same
date (december 22nd) has to be calculated.
Both christmas day's and the weekend are holidays, so these dates should
not be generated by the (modified) formula.

I already have a list with official dutch holidays defined in range A7:A47
on a sheet (tab) called "Feestdagen".

Is there a way to modify the formula mentioned above, to do this ?




Best regards,

Frits Jager
The Netherlands
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,547
The Analysis Toolpak has a function called Workday, which can accept a list of holidays. Do you have access to that?
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
It would look something like

=WORKDAY(VERT.ZOEKEN(C168;Variabelen!$B$5:$E$20;2;ONWAAR)+E168+1;-1;Feestdagen!$A$7:$A$47)
 

sweater_vests_rock

Well-known Member
Joined
Oct 8, 2004
Messages
1,657
frits.

one option would be to add to check to see if the date returned is on your list of holiday dates. if it is, replace that date with the adjusted date (which i'll assume is in B7:B47 on 'Feestdagen'). using your christmas example,

Code:
=IF(COUNTIF(Feestdagen!$A$7:$A$47,VERT.ZOEKEN(Invoerchem!C168;Variabelen!$B$5:$E$20;2;ONWAAR)+Invoerchem!E168)>0, VLOOKUP(VERT.ZOEKEN(Invoerchem!C168;Variabelen!$B$5:$E$20;2;ONWAAR)+Invoerchem!E168, Feestdagen!$A$7:$B$47, 2, FALSE)

i can't test this, unfortunately, but it should get you most the way there.

cheers. ben.
 

Flash0220

Board Regular
Joined
May 2, 2002
Messages
104
Hello,


The formula "=WORKDAY(VERT.ZOEKEN(C168;Variabelen!$B$5:$E$20;2;ONWAAR)+E168+1;-1;Feestdagen!$A$7:$A$47)" worked perfectly !
Thanks !




Best regards,

Frits Jager
The Netherlands
 

Forum statistics

Threads
1,136,586
Messages
5,676,666
Members
419,639
Latest member
ShaunAldridge

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
Top