nonethefewer: (Default)
2009-06-10 03:40 pm

I write these for future-me.

The formula to return the text day of the week for a given date in Excel:

=CHOOSE(WEEKDAY(A1, 1), "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

(Also totally works in Google Spreadsheets.)

The WEEKDAY(date, type) function takes a date and returns the number of the day of the week.  So WEEKDAY("2009-06-10", 1) would return 4 - Wednesday is the fourth day of the week.

type in that formula:

* 1 or no value == 1 (Sunday) through 7 (Saturday)
* 2 == 1 (Monday) through 7 (Sunday)
* 3 == 0 (Monday) through 6 (Sunday)

(So US-centric.)

CHOOSE(index#, [item1, item2, ...]) takes two things - an index number, and a set of values to choose from.  (No brackets, though - that's just for ease of descriptifying.)

*makes "and so therefore" gesture*