Solved

Zellers congruance in Excel

Posted on 2000-04-04
3
237 Views
Last Modified: 2012-05-04
Does anyone have an algorithm to calculate which day of the week a date falls on in Excel?  
0
Comment
Question by:cotec1
3 Comments
 
LVL 1

Accepted Solution

by:
Chrynoble earned 50 total points
Comment Utility
Yes,

in a worksheet
=weekday(B4)

in VBA
Weekday(MyDateVar)

Sunday is 1, Monday 2, etc....
0
 
LVL 5

Expert Comment

by:TigerMan
Comment Utility
cotec1,

The weekday function can return various ranges of values - dependent on the second parameter that you pass to the function, i.e.

= WeekDay (B4,1) will return a number from 1(Sunday) to 7(Saturday) [this is also the default value if you don't specify a parameter],

= Weekday (B4,2) will return a number from 1(Monday to 7(Sunday), and

= Weekday (B4,3) returns a number from 0(Monday) to 6(Sunday).

After you determine the numeric value of the weekday you are working with, by using the above =weekday(B4) worksheet function, you might then like to determine what the name of the weekday is.

The easiest way that I have found to accomplish that is by setting up a little table somewhere.  Using the 1(Sunday) to 7(Saturday) model, your table might look like:

1  Sunday
2  Monday
3
4
5
6
7  Saturday

Select all these cells and Name the range as WeekdayTable or similar.

Then to determine the name of the day, in another cell enter the formula:

= VLookUp(C4, WeekDayTable, 2).

But when its all said and done, by far the easiest way to determine the weekday is by using:

=TEXT("" & B4, "dddd")

This will return the day name from a date field in B4.


Crynoble, it is not normal practice to enter responses as Answers unless you are dead certain that your response exactly fits the question.  It is usual practice to just use the commenting facility.


Dave

0
 
LVL 9

Expert Comment

by:antrat
Comment Utility
Hi cotec1

Suppose your date is in cell A1 all you would have to do is in any cell put =A1 then go to Format>Cells>Number>Custom and using anyone of the pre-defined formats as a starting point, type dddd.

This will now convert the date to the day of the week that it falls. e.g if the date is a Saturday then dddd format will return Saturday. ddd will return Sat and dd or d will return the day of the month.

Of course you could just applt]y this format to A1.

Good luck

antrat
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

743 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