# WEEKDAY vs. WORKDAY | CSE 148 – Excel Exam 1

Still feeling nervous for your exam? Check out the Excel Cram Kit (Exam 1) for practice modules that emulate the difficulty that you'll face on your exam. Each module includes a thorough step-by-step explanation where I walk you through the entire problem solving process!

## WEEKDAY vs. WORKDAY explained

### WEEKDAY

Imagine you've got a dentist appointment on October 15, 2018. You typically work Mondays, Wednesdays, and Fridays, so you'll need to know if you should request off work for this appointment.

Using a calendar, we'd go back to the given date and determine that it's on a Monday, so we'd need to request off work.

The WEEKDAY function does the exact same thing!

Given a date, the WEEKDAY function returns a number between 1-7 representing what day of the week the date is on.

### WORKDAY

The WORKDAY function, by contrast, is completely different. It's easy to get them twisted though, so let's visualize the difference.

Say you're ordering your very own Coding for Crammers sweatshirt on Teespring (yes, we have merch) on March 1, 2010 and it takes 7 days to ship.

We can't just add 7 days to our order date, because the company does not ship on non-business days (weekends/holidays). So, how can we figure out what date it'll ship?

Using a calendar, we can start at March 1, 2010 and skip over weekends until we arrive to 7 business days in the future.

This is exactly what the WORKDAY function does!

The WORKDAY function, given a date and number of days in the future, returns the future date (skipping over weekends and holidays).

## Coding a WEEKDAY function

With our dentist appointment, we needed to figure out what day of the week October 15, 2018 was.

Given the WEEKDAY function template...

=WEEKDAY(serial_number, [return_type])

...we'd first place the date that we're looking for into the serial_number argument. To do this, all we need to do is reference the cell in which the date is placed, so B1.

=WEEKDAY(B1, [return_type])

Because at their core, dates in Excel are actually just really long numbers representing the number of days since January 0, 1990, plus a fraction representing the 24-hour day.

So "1" represents January 1, 1990, "2" represents January 2, 1990, "3 1/24" represents 01:00 on January 3, 1990, and so on.

For [return_type], we can actually leave this blank, since it's wrapped in brackets.

Leaving [return_type] blank results in the days of the week being mapped like so:

Therefore, 1 represents Sunday, 2 represents Monday, and so on.

Now that we've got our WEEKDAY function ready to code, let's plug it into Excel and see what we get!

We get 2, meaning that October 15, 2018 is on a Monday. This matches what we saw on our calendar!

### Using different return_types

If we wanted to map the days of the week in a different way, here are some of the other common patterns:

Given the same date above, let's plug in "2" as our [return_type] like so:

=WEEKDAY(A1, 2)

Notice how this gives us "1" now, since in this [return_type], 1-7 represents Monday-Sunday.

This still means that 10/15/18 occurs on a Monday, except now instead of Monday being mapped to 2, it's mapped to 1!

With the WEEKDAY function, days of the week are (typically) represented with numbers 1-7, representing Sunday-Saturday. You can modify this mapping by changing your [return_type] argument.

## Coding a WORKDAY function

Given the following WORKDAY template...

=WORKDAY(start_date, days, [holidays])

...let's figure out when our Coding for Crammers shirt order from above will ship.

Our start_date is going to be the date that we placed the order, which is March 1, 2010. This occurs in cell A2.

=WORKDAY(A2, days, [holidays])

Our days is going to represent how many business days in the future we need to look. This will be 7, since our shirt ships 7 days in the future. This value occurs in cell B2.

=WORKDAY(A2, B2, [holidays])

We can skip over the [holidays] argument for now since it's in brackets.

With these values, we can code our WORKDAY function like so...

...and learn that our CODE ON TAP sweatshirt will ship March 10, 2010.

In the case that this happens to you, make sure that the format of the cell is date. Chances are, it's currently formatted as a regular number.

### Using holidays

We can use the [holidays] argument to list dates that should be considered holidays, and therefore not workdays.

For example, what if we wanted to classify March 2, 2010 (Tuesday) as a holiday?

It would move our ship date back one day from March 10 to March 11. Why?

Because March 2, 2010 was a Tuesday, and therefore normally classified as a work/business day. Since we made it a holiday, it essentially became a weekend, therefore pushing our ship date back one day.

The [holidays] argument enables us to list dates to not be considered workdays, when they otherwise would.

## Practice Problem

Your coworkers want to go get dinner on September 24, 2015. You need to make sure that it's not a Monday night though, since you and your roommates religiously watch "The Bachelor" and you can't miss an episode.

How can you make sure that September 24, 2015 is not a Monday with Excel? Should you use a WEEKDAY or WORKDAY function?

=WEEKDAY(B1)

Answer: It's not a Monday! 5 is mapped to a Thursday with the default [return_type].

## Excel (Exam 1) Follow-along Guide

It's no secret you retain info better when you write it down. That's why I created the Excel (Exam 1) Follow-along Guide for you!

As you come upon key concepts highlighted in yellow, like this sentence here, you can fill-in-the-blanks on your Follow-along Guide so that you remember all the important stuff for later!

You can obtain the Excel (Exam 1) Follow-along Guide for FREE by entering your email below!

Next, let's learn about how to use the VLOOKUP function to find values in a list!

### Free Resources

Each exam concept broken down in simple, real-world examples!

### Practice Problems

Step-by-step walkthrough for each of the questions you need to be ready for!

"I bought this Cram Kit the night before my exam, and it helped me tremendously. It provides step-by-step explanations for all the units covered in class."

Matt Lamanna
Oct. 24, 2021

Rating: 5 out of 5.