Solved

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

Posted on 2014-12-10
2
214 Views
Last Modified: 2014-12-10
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
Comment
Question by:Brad Rubin
2 Comments
 
LVL 3

Accepted Solution

by:
Richard Obenchain earned 500 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

by:Brad Rubin
ID: 40492909
Much appreciated...worked well.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Outlook Free & Paid Tools
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now