dates excel
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Dates in Excel

Dates in Excel

resolvedResolved · High Priority · Version 2003

replyReply Tue 8 Jul 2008, 16:02Delegate Christopher said...

Christopher has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Dates in Excel

Hi

I have a s/s that looks at the price of stocks it compares today against the previous day to find the % up or down. On Monday when I come to work the s/s points to Sunday therefore I cannot pull correct data in. The question is how can I write a formula to day if the date = a weekend default to the Friday before? Thanks in advance.

For upcoming training course dates see: Pricing & availability

replyReply Thu 10 Jul 2008, 10:53Trainer Katie said...

RE: Dates in Excel

Hi Christopher,

Thank you for your question.

You will need to use a nested IF to filter out the weekend dates. Also, to obtain the weekday, you need the function WEEKDAY.

If the date value is in cell A1, this is an example how you can move weekends into previous Friday:
=IF(WEEKDAY(A1,2)=6,A1-1,IF(WEEKDAY(A1,2)=7,A1-2,A1))

Explaination:
The 1st IF:
WEEKDAY(A1,2)=6 - tests if date falls on Saturday
A1-1 - moves 1 day backward to previous Friday

The 2nd IF:
WEEKDAY(A1,2)=7 - tests if date falls on Sunday
A1-2 - moves 2 days backward to previous Friday

If the weekday is neither 6 nor 7, it returns the date value on cell A1.

Hope this helps.

Kind regards,

Katie Woo
Microsoft Certified Trainer

 

Please browse our web site to find out more about
excel course tate modern and other Microsoft training courses.

Excel tip:

Current date

CTRL+SEMICOLON

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard