#1   Report Post  
Posted to microsoft.public.excel.misc
EJB EJB is offline
external usenet poster
 
Posts: 4
Default Weekday formula?

Hi maybe someone can help me.

I want to calculate the day previous to a given date ...
for example if I enter
06/11/2007 I want to return 05/11/2007
However if the day entered is a Monday I want to return the previous
Friday's date
for example if I enter
05/11/2007 I want to return 02/11/2007

I have been trying an IF but to no avail. Any suggestions greatfully
received :) I figure it must be possible. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default Weekday formula?

=WORKDAY(A1,-1)

If you get a #NAME error:

ToolsAdd-ins, check Analysis Toolpak

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"EJB" wrote in message ...
| Hi maybe someone can help me.
|
| I want to calculate the day previous to a given date ...
| for example if I enter
| 06/11/2007 I want to return 05/11/2007
| However if the day entered is a Monday I want to return the previous
| Friday's date
| for example if I enter
| 05/11/2007 I want to return 02/11/2007
|
| I have been trying an IF but to no avail. Any suggestions greatfully
| received :) I figure it must be possible. Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
EJB EJB is offline
external usenet poster
 
Posts: 4
Default Weekday formula?

Thanks very much - so simple when you know how :) You have saved me hours!

"Niek Otten" wrote:

=WORKDAY(A1,-1)

If you get a #NAME error:

ToolsAdd-ins, check Analysis Toolpak

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"EJB" wrote in message ...
| Hi maybe someone can help me.
|
| I want to calculate the day previous to a given date ...
| for example if I enter
| 06/11/2007 I want to return 05/11/2007
| However if the day entered is a Monday I want to return the previous
| Friday's date
| for example if I enter
| 05/11/2007 I want to return 02/11/2007
|
| I have been trying an IF but to no avail. Any suggestions greatfully
| received :) I figure it must be possible. Thanks



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Weekday formula?

I'm assuming you will only enter a date that is Monday through Friday.

=A1-CHOOSE(WEEKDAY(A1,2),3,1,1,1,1)

If you enter a date that is either Sat or Sun the formula will return an
error.

--
Biff
Microsoft Excel MVP


"EJB" wrote in message
...
Hi maybe someone can help me.

I want to calculate the day previous to a given date ...
for example if I enter
06/11/2007 I want to return 05/11/2007
However if the day entered is a Monday I want to return the previous
Friday's date
for example if I enter
05/11/2007 I want to return 02/11/2007

I have been trying an IF but to no avail. Any suggestions greatfully
received :) I figure it must be possible. Thanks





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Weekday formula?

One way

=A1-CHOOSE(WEEKDAY(A1,2),3,1,1,1,1,1,2)



--


Regards,


Peo Sjoblom




"EJB" wrote in message
...
Hi maybe someone can help me.

I want to calculate the day previous to a given date ...
for example if I enter
06/11/2007 I want to return 05/11/2007
However if the day entered is a Monday I want to return the previous
Friday's date
for example if I enter
05/11/2007 I want to return 02/11/2007

I have been trying an IF but to no avail. Any suggestions greatfully
received :) I figure it must be possible. Thanks



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 947
Default Weekday formula?

A non WORKDAY() solution might be:

=A1-CHOOSE(WEEKDAY(A1,2),3,1,1,1,1,1,2)
or
=A1-MOD(328681,WEEKDAY(A1,2)+6)

--
Dana DeLouis


"EJB" wrote in message
...
Hi maybe someone can help me.

I want to calculate the day previous to a given date ...
for example if I enter
06/11/2007 I want to return 05/11/2007
However if the day entered is a Monday I want to return the previous
Friday's date
for example if I enter
05/11/2007 I want to return 02/11/2007

I have been trying an IF but to no avail. Any suggestions greatfully
received :) I figure it must be possible. Thanks



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default Weekday formula?

"Dana DeLouis" wrote in message
...
=A1-MOD(328681,WEEKDAY(A1,2)+6)


And yet another magic number pulled out of your black bag! <g

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date formula not picking up 1st of the month (weekday) Ang Excel Discussion (Misc queries) 3 September 5th 07 01:58 PM
WEEKDAY() function: display TEXT not numeric weekday tom Excel Discussion (Misc queries) 3 November 21st 06 04:32 PM
Weekday formula calculating to end of month DebbieK Excel Worksheet Functions 0 July 26th 06 08:08 PM
Weekday Formula fastballfreddy Excel Discussion (Misc queries) 4 May 8th 06 07:36 PM
Difficult formula SUMPRODUCT,MATCH,WEEKDAY edwardpestian Excel Worksheet Functions 7 May 8th 06 11:53 AM


All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"