Dave,
I will try, but I don't know what I can add that wasn't in Harlan's original
post.
As Harlan said, N4 contains a date. Although the date may look like say
07/06/03 (i.e. a date). in Excel it is actually the number of days since 1st
Jan 1900. So a cell with 09/08/03 actually stores the n umber 37,842.
This formula is then working out which day that is between 0 and 6 to start
to get a day name. So it takes the modulus 7 of that number using the MOD
function. MOD Returns the remainder after number is divided by divisor. So,
again using today's date, MOD(09/08/84,7) returns 0, as the 1st Jan 1900 was
a Saturday, the weekday number today is 0. Tomorrow will return 1, Monday
will return 2, and next Saturday will again return 0.
Knowing the day number, we can simply pass this to a CHOOSE statement looks
up that entry in an array of names
CHOOSE(MOD(N4,7),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"
"")). The IF statement is there as CHOOSE is 1-based, and MOD 7 returns 0-6,
so you have to cater for the 0 instance. Whoever wrote the code did this by
catering for 0 with the IF, but it could just as easily be done by
=CHOOSE(MOD(N4,7)+1,"Saturday","Sunday","Monday","Tuesday","Wednesday","Thur
sday","Friday")
But as Harlan says, it's all superfluous, because the formula
=TEXT(N4, "dddd")
does it better.
Hope that helps.