Cell B7 is a date. In cell B8 I am trying to write an IF statement that will perform different calculations depending on the day of the week the date in B7 falls on. If the date in B7 is a Saturday, add 3 (days) to B7. If the date in B7 is a Sunday, add 2 (days) to B7. My problem is I don’t know how to write the IF statement in such a way that it knows what day the date is in B7. Any advise would be much appreciated. Many thanks.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Help needed with an IF statement (2002)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Help needed with an IF statement (2002)
- This topic has 22 replies, 4 voices, and was last updated 16 years, 8 months ago.
Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerAugust 26, 2008 at 9:08 pm #1123326What should B8 contain if B7 is not a Saturday or Sunday? If you want the same date as in B7:
=B7+IF(WEEKDAY(B7)=7,3,IF(WEEKDAY(B7)=1,2,0))
And if you want the next day:
=B7+IF(WEEKDAY(B7)=7,3,IF(WEEKDAY(B7)=1,2,1))
WEEKDAY(B7) returns a number that indicates the day of the week, where 1 = Sunday, 2 = Monday, …, 7 = Saturday.
-
bumblebee
AskWoody Plus -
bumblebee
AskWoody PlusAugust 27, 2008 at 10:37 pm #1123497Following on from the formula you suggested above, how could this be amended to take into account the following:
1. If cell B6=”Saturday” (as text) and the date in B7 is a Saturday then don’t add anything. Otherwise perform the rest of the formula you have stated.
2. The formula also needs to take into account bank holidays. So if B7 = Saturday, add 3 days but if the Monday is a Bank Holiday, add 1 more day. If B7 = Sunday, add 2 days but if the Monday is a Bank Holiday, add 1 more day. If B7 isn’t a Saturday or Sunday, don’t add anything.
How would I structure my IF statement to cover these scenarios? I know I need to enter a range of dates that would be my Bank Holidays.
Really appreciate your advice again. Thanks.
-
WSHansV
AskWoody Lounger -
WSsdckapr
AskWoody LoungerAugust 27, 2008 at 11:51 pm #1123499How about modifying Hans’ formula for 2 (presuming that D1:D10 has a list of dates that are bank holidays):
=B7+IF(WEEKDAY(B7)=7,IF(B6=”Saturday”,0,3),IF(WEEKDAY(B7)=1,2,0))+ISNUMBER(MATCH(B7+1,$D$1:$D$10,0))+ISNUMBER(MATCH(B7+2,$D$1:$D$10,0))
Note if B7 is the Bank Holiday, it is not a Saturday nor Sunday so would not change. Is this what you are after?
Steve
-
bumblebee
AskWoody Plus -
bumblebee
AskWoody PlusAugust 28, 2008 at 10:50 pm #1123632The latest formula you’ve suggested does do what I expect SOME of the time. Attached is the spreadsheet which will make it easier to explain. The idea is for a user to enter an order date and a working day leadtime (if there is one). Excel calculates this into calendar days. The user then has to select a delivery service. I’ve then used cell B7 to calculate a temporary date so that further calculations can be carried out in cell B8. My idea was that row 7 would be hidden so the user only sees the final result in B8. I’m happy to scrap row 7 if one formula in B8 can achieve all of this. A delivery date must only ever occur on a Saturday if the user has selected a Saturday delivery in B6. Deliveries CANNOT ever take place on a Sunday or Bank Holiday. So if 2 working days delivery is selected this must count 2 working days AND take into account bank holidays (range Z18:Z44). Making the order date 22/08/2008 and then choosing your delivery service is a good way to see how the formula responds (as the 25th was a UK bank holiday). I accept that the spreadsheet has evolved a little since my posts yesterday! Thanks, Mark
-
WSHansV
AskWoody LoungerAugust 28, 2008 at 11:57 pm #1123636Does the attached version do what you want? It uses a custom function WorkdayPlus that includes Saturdays as working days:
Function WorkdayPlus(Start_Date As Date, Days As Long, Optional Holidays) As Date
Dim d As Date
Dim n As Long
Dim varItm As Variant
If Days = 0 Then
WorkdayPlus = Start_Date
Else
d = Start_Date
Do
d = d + 1
If Weekday(d) > 1 Then
n = n + 1
If Not IsMissing(Holidays) Then
For Each varItm In Holidays
If d = varItm Then
n = n – 1
Exit For
End If
Next varItm
End If
End If
Loop Until n = Days
WorkdayPlus = d
End If
End Function -
bumblebee
AskWoody Plus -
WSHansV
AskWoody Lounger -
bumblebee
AskWoody Plus -
WSHansV
AskWoody Lounger -
bumblebee
AskWoody PlusAugust 29, 2008 at 1:32 am #1123651 -
WSHansV
AskWoody LoungerAugust 29, 2008 at 1:30 am #1123653There is no need to uninstall Analysis ToolPak; you can keep on using it.
I just worked around it because translation issues make it impossible for me to solve your problem using Analysis ToolPak. I’m using the Dutch language version of Excel.
Excel will automatically translate standard worksheet functions such as SUM or MATCH to the local language of the user, so you’ll see English function names and I’ll see Dutch function names.
However, this translation does not occur for Analysis ToolPak functions. So the WORKDAY function causes an error when I open your workbook. I can repair that by changing WORKDAY to its Dutch equivalent, but then you will get an error when you open the workbook, as you have found. -
bumblebee
AskWoody Plus -
WSHansV
AskWoody Lounger -
bumblebee
AskWoody PlusSeptember 9, 2008 at 8:06 pm #1124918Thank you. In addition to the formula Hans provided above that worked off a working day value, I also need a formula (in B17) to work off a calendar day value (B15) as per the attached spreadsheet. I suspect Hans’ formula just needs a slight modification but I can’t figure this out. For example todays date is Tues 9 Sept. Calendar days lead time is 5 (but this falls on a Sunday). Delivery service chosen is ‘Standard -2 working days’. So the delivery date should equal Wed 17 Sept. (This is because the supplier won’t hand over the goods to the courier until the Monday 15th). Thanks again.
-
WSHansV
AskWoody Lounger -
WSsdckapr
AskWoody LoungerAugust 29, 2008 at 12:06 am #1123637How about in B8: (I don’t use any of the intermediate formulas)
=CHOOSE(MATCH(B6,$Y$18:$Y$20,0), WORKDAY($B$3,2,$Z$18:$Z$44), WORKDAY($B$3,1,$Z$18:$Z$44), IF(WEEKDAY(B1+1)=7,B1+1, WORKDAY($B$3,1,$Z$18:$Z$44)))Though personally I would prefer inserting the 3 formulas next to each of lookup values in Y and then use a Vlookup.
Steve
-
WSHansV
AskWoody Lounger -
WSsdckapr
AskWoody Lounger
-
-
-
-
WSmikerickson
AskWoody LoungerViewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
2 hours, 53 minutes ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
23 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
3 hours, 25 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
19 hours, 48 minutes ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
10 hours, 13 minutes ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
22 hours, 28 minutes ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
14 hours, 44 minutes ago -
Some advice for managing my wireless internet gateway
by
LHiggins
10 hours, 25 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
16 hours, 41 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
1 day, 7 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
1 day, 4 hours ago -
Does windows update component store “self heal”?
by
Mike Cross
18 hours, 18 minutes ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
1 day, 21 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
5 hours, 52 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
9 hours, 33 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
2 days ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
2 days ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 day, 13 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
2 days, 8 hours ago -
0Patch, where to begin
by
cassel23
2 days, 2 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
2 days, 22 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
2 days, 10 hours ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
3 days, 6 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
2 days, 21 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
7 minutes ago -
Installer program can’t read my registry
by
Peobody
2 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
2 days, 19 hours ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
3 days, 3 hours ago -
False error message from eMClient
by
WSSebastian42
3 days, 18 hours ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
4 days, 3 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.