View Single Post
  #3   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

That one only worked if all three days were needed. Try this version instead:

=IF(G1<"",IF(MOD(TRUNC(K1-J1)+1,7)MOD(MATCH(G1,{"Saturday","Sunday","Monday ","Tuesday","Wednesday","Thursday","Friday"},FALSE )-1-INT(MOD(J1,7))+7,7),1,0)+INT((INT(K1-J1)+1)/7))+IF(H1<"",IF(MOD(TRUNC(K1-J1)+1,7)MOD(MATCH(H1,{"Saturday","Sunday","Monday ","Tuesday","Wednesday","Thursday","Friday"},FALSE )-1-INT(MOD(J1,7))+7,7),1,0)+INT((INT(K1-J1)+1)/7))+IF(I1<"",IF(MOD(TRUNC(K1-J1)+1,7)MOD(MATCH(I1,{"Saturday","Sunday","Monday ","Tuesday","Wednesday","Thursday","Friday"},FALSE )-1-INT(MOD(J1,7))+7,7),1,0)+INT((INT(K1-J1)+1)/7))

--
HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
=IF(MOD(TRUNC(K1-J1)+1,7)MOD(MATCH(G1,{"Saturday","Sunday","Monday ","Tuesday","Wednesday","Thursday","Friday"},FALSE )-1-INT(MOD(J1,7))+7,7),1,0)+INT((INT(K1-J1)+1)/7)+IF(MOD(TRUNC(K1-J1)+1,7)MOD(MATCH(H1,{"Saturday","Sunday","Monday ","Tuesday","Wednesday","Thursday","Friday"},FALSE )-1-INT(MOD(J1,7))+7,7),1,0)+INT((INT(K1-J1)+1)/7)+IF(MOD(TRUNC(K1-J1)+1,7)MOD(MATCH(I1,{"Saturday","Sunday","Monday ","Tuesday","Wednesday","Thursday","Friday"},FALSE )-1-INT(MOD(J1,7))+7,7),1,0)+INT((INT(K1-J1)+1)/7)

All in one cell - watch the line breaks. Written for row 1, but can be copied down. I'm sure
Harlan will come up with a much shorter formula - the array formula that I had that was one third
shorter didn't work with blanks, so I gave up on that approach.

HTH,
Bernie
MS Excel MVP


"girlfriend in school" wrote in message
...
I need to count the number of days between a start date and end date and the
questions about this I found here don't seem to help (boggle me!) I need a
universal formula that will cover variable days which are listed in a
separate column:
G (rows) = names of days; J (rows) = start date; K (rows) = end date. On
top of this, I am sometimes having to count more than one day (up to three)
within a week (e.g., Mondays AND Fridays) which I'd be willing to put in
separate columns (i.e., columns G,H,I) if needed, but if only one column has
a day listed, the formula needs to ignore the empty columns.
A knotty problem?