Solved

Showing a date range

Posted on 2013-11-25
3
165 Views
Last Modified: 2013-11-25
I would like to be able to display the dates from Monday to Friday of a particular week on a report using the system date (which will be a date that falls during that particular week, between Mon to Friday). For example, if the system date is 11/27/2013, it will show: 11/25/13 - 11/29/13. If the date is 11/26/13, it will still show: 11/25/13 - 11/29/13. If the date is 12/5, it will show: 12/2-12/6.

Is there anyway I could accomplish this?
0
Comment
Question by:geeta_m9
[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
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 39675178
<Is there anyway I could accomplish this? >

yes, but you need to create a user define function in vba

sample

Function GetWeekDate(d As Date)  
Dim monDate As Date
monDate = d + 1 - Weekday(d, 2)
GetWeekDate = monDate & "-" & DateAdd("d", 4, monDate)
End Function
0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 250 total points
ID: 39675623
to get the date of the Monday of the current week (Mon-Fri), use:

?dateadd("d", weekday(date(), vbMonday) -1, date())

To get the Friday of the same week, use:

?dateadd("d", 5-weekday(date(), vbMonday), date())
0
 

Author Closing Comment

by:geeta_m9
ID: 39675840
Both the solutions work well, thanks.
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

623 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