[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# Can I get a formula for identifying the date of the last day of the week?

Posted on 2014-12-10
Medium Priority
242 Views
I would like to run a formula across a spreadsheet to breakup data into weekly segments for a pivot table. I want to graph that data by the date of the last day for a week.

I want to make a week equal to Monday - Sunday. I can do this with a Weeknum function below.

Example:
=WEEKNUM("1/1/14", 2) to get a value of "1"

Question:
I need help with a formula where the value would represent the date of the Sunday at the end of the week. So in the example above, the result of "1" would be equal to 1/5/14. I would like to use this formula across a lot of data for an entire year so an ability to fill down is desired.
0
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 3

Accepted Solution

Richard Obenchain earned 2000 total points
ID: 40492897
You don't need the week function to do it.

WeekDay([cell],2) will return the Monday-Sunday day of the week (1-7).  So, you do:

=[cell]+(7-WEEKDAY([cell],2))

... where [cell] is your reference date.  This will look at the current date, figure out how many days it is to the next Sunday, and then add that number of days.

If you want to be absolutely sure you never get a time value added (so that it's just the date part), you can do:

=date(year([cell]+(7-WEEKDAY([cell],2))),month([cell]+(7-WEEKDAY([cell],2))),day([cell]+(7-WEEKDAY([cell],2))))

or more simply:

=date(year([cell]),month([cell]),day([cell]))+(7-WEEKDAY([cell],2))
0

LVL 4

Author Closing Comment

ID: 40492909
Much appreciated...worked well.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
###### Suggested Courses
Course of the Month13 days, 15 hours left to enroll