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.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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 Lounger
Viewing 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
-
My Simple Word 2010 Macro Is Not Working (Awaiting moderation)
by
mbennett555
7 hours, 17 minutes ago -
Office gets current release
by
Susan Bradley
12 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 4 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
13 hours, 3 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 5 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 15 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 17 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 17 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
1 day, 18 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
1 day, 19 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 7 hours ago -
Enabling Secureboot
by
ITguy
1 day, 14 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 2 hours ago -
No more rounded corners??
by
CWBillow
1 day, 22 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 12 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 15 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 17 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 12 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 1 hour ago -
May preview updates
by
Susan Bradley
2 days, 12 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 4 hours ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 17 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 14 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 16 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 16 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
14 hours, 32 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
4 days, 5 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
2 days, 3 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
4 days, 18 hours ago -
Another test post
by
gtd12345
4 days, 18 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.