Returning Day Names and Weekday Numbers

Four different Calculations to use in Spreadsheets and Databases in ClarisWorks, and Tables in ClarisImpact

This information was provided by Claris Corporation on 16 March 1998, and incorporated into Apple Computer's Tech Info Library.

To obtain a day name such as "Monday" based upon a date entered into a cell (in a spreadsheet in ClarisWorks, a table in ClarisImpact, or a field in a ClarisWorks database) you need to create specific calculations to do this. There is no built-in menu function in ClarisWorks or ClarisImpact that generates the day of the week automatically. There are four different calculations to use that will return the desired result.

Spreadsheet or table
In a spreadsheet or table, you can return a day name or you can return the weekday number that it represents (1 through 7). The following examples assume that cell A1 is a date and A2 is the result.

1. To return the dayÕs name, use this calculation for cell A2:

=DAYNAME(WEEKDAY(A1))

Cell A1 has an entry of 1/14/96 that returns "Sunday" in cell A2.

2. To return the weekday number that the date represents, use the following for a week
that begins with Monday as day 1 and ends with Sunday as day 7:

=IF(WEEKDAY(A1)=1, 7, WEEKDAY(A1)-1)

Cell A1 with the entry of 1/14/96 will return the

number 7 in cell A2.

3. To return a weekday number that begins with Sunday as day 1 and ends with Saturday
as day 7, use the following:

=WEEKDAY(A1)

The entry of 1/14/96 in cell A1 returns the number 1
in cell A2.

4. If you want the weekday number to be returned with Sunday beginning as day 0 and
ending with Saturday as day 6, the following will apply:

=WEEKDAY(A1)-1

Cell A1 with the entry of 1/14/96 returns the number 0 in cell A2.

Database
The calculations are slightly different than those in a spreadsheet or a table. Define the fields as follows, (assuming that "datefield' is where the date is entered and "weekname' or whatever you choose as a name will have these calculation(s) defined):

1. To return the day's name, use the following calculation:

DAYNAME(WEEKDAY('datefield'))

The "datefield' entry of 1/14/96 will return "Sunday" in the Ôweekname' field.

2. To return the weekday number that the date represents, use the following for a week
that begins with Monday as day 1 and ends with Sunday as day 7:


IF(WEEKDAY('datefield')=1, 7, WEEKDAY('datefield')-1)

The "datefield" entry of 1/14/96 will return the
number 7.

3. To return a weekday number that begins with Sunday as day 1 and ends with Saturday
as day 7 use the following:

WEEKDAY('datefield')

The "datefield" entry of 1/14/96 will return the
number 1.

4. If you want the weekday number to be returned with Sunday beginning as day 0 and
Saturday as day 6, the following will apply:

WEEKDAY('datefield')-1

The "datefield" entry of 1/14/96 will return the
number 0.

Note: In FileMaker Pro there is a calculation function called DAYNAME (date field) that does return the values Monday through Friday in a single step.

Published Date: Feb 18, 2012