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, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
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, 7 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
-
AugLoop.All (TEST Augmentation Loop MSIT)
by
LarryK
1 minute ago -
Boot Sequence for Dell Optiplex 7070 Tower
by
Serge Carniol
9 hours, 34 minutes ago -
OTT Upgrade Windows 11 to 24H2 on Unsupported Hardware
by
bbearren
13 hours, 7 minutes ago -
Inetpub can be tricked
by
Susan Bradley
14 hours, 27 minutes ago -
How merge Outlook 2016 .pst file w/into newly created Outlook 2024 install .pst?
by
Tex265
11 hours, 12 minutes ago -
FBI 2024 Internet Crime Report
by
Alex5723
16 hours, 57 minutes ago -
Perplexity CEO says its browser will track everything users do online
by
Alex5723
4 hours, 43 minutes ago -
Login issues with Windows Hello
by
CWBillow
1 day, 4 hours ago -
How to get into a manual setup screen in 2024 Outlook classic?
by
Tex265
15 hours, 56 minutes ago -
Linux : ARMO rootkit “Curing”
by
Alex5723
1 day, 15 hours ago -
Employee monitoring app leaks 21 million screenshots in real time
by
Alex5723
1 day, 15 hours ago -
Google AI is now hallucinating idioms
by
Alex5723
1 day, 16 hours ago -
april update
by
69800
18 hours, 24 minutes ago -
Windows 11 Insider Preview build 27842 released to Canary
by
joep517
1 day, 17 hours ago -
Quick Fix for Slowing File Explorer
by
Drcard:))
1 day, 17 hours ago -
WuMgr not loading?
by
LHiggins
13 hours, 4 minutes ago -
Word crashes when accessing Help
by
CWBillow
21 hours, 24 minutes ago -
New Microsoft Nag — Danger! Danger! sign-in to your Microsoft Account
by
EricB
1 day, 16 hours ago -
Blank Inetpub folder
by
Susan Bradley
1 day, 14 hours ago -
Google : Extended Repair Program for Pixel 7a
by
Alex5723
2 days, 3 hours ago -
Updates seem to have broken Microsoft Edge
by
rebop2020
1 day, 13 hours ago -
Wait command?
by
CWBillow
1 day, 20 hours ago -
Malwarebytes 5 Free version manual platform updates
by
Bob99
2 days, 10 hours ago -
inetpub : Microsoft’s patch for CVE-2025–21204 introduces vulnerability
by
Alex5723
2 days, 16 hours ago -
Windows 10 finally gets fix
by
Susan Bradley
3 days, 1 hour ago -
AMD Ryzen™ Chipset Driver Release Notes 7.04.09.545
by
Alex5723
3 days, 2 hours ago -
How to use Skype after May?
by
Joann
1 day, 11 hours ago -
Win 7 MS Essentials suddenly not showing number of items scanned.
by
Oldtimer
2 days, 21 hours ago -
France : A law requiring messaging apps to implement a backdoor ..
by
Alex5723
3 days, 16 hours ago -
Dev runs Windows 11 ARM on an iPad Air M2
by
Alex5723
3 days, 16 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.