Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Lillian F
 
Posts: n/a
Default How to Calculate Dates without counting the weekends

I need the formula to calculate dates (Mondy to Friday) without counting the
weekends
  #4   Report Post  
Jason Morin
 
Posts: n/a
Default

And if you can't use NETWORKDAYS because your girlfriend
can't find the Office install CD for her home PC and thus
you can't install the Analysis ToolPak add-in, try:

=SUMPRODUCT(--(LEFT(TEXT(ROW(INDIRECT(J1&":"&K1)),"ddd"))
<"S"))

;-)
HTH
Jason
Atlanta, GA

-----Original Message-----
I need the formula to calculate dates (Mondy to Friday)

without counting the
weekends
.

  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

Typical bloke, blame the girlfriend :-). Anyway, Lillian could be a female
name as well as a guy's.

Nice formula though.

Bob


"Jason Morin" wrote in message
...
And if you can't use NETWORKDAYS because your girlfriend
can't find the Office install CD for her home PC and thus
you can't install the Analysis ToolPak add-in, try:

=SUMPRODUCT(--(LEFT(TEXT(ROW(INDIRECT(J1&":"&K1)),"ddd"))
<"S"))

;-)
HTH
Jason
Atlanta, GA

-----Original Message-----
I need the formula to calculate dates (Mondy to Friday)

without counting the
weekends
.





  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

Jason,

That's a neat formula, and it has the advantage over NETWORKDAYS of not
mattering which order you put the dates in (that has always been an
annoyance of NETWORKDAYS to me). I thought it would be improved a bit if you
used

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2)<6))

as it doesn't have to do any string matching then, and it removes one nested
function. Furthermore, it can omit Fridays more easily if you test for < 5,
or even use an array of allowable days, such as {3,4,5} (making by beautiful
UDF redundant :-)). The obvious disadvantage is that NETWORKDAYS can
exclude holidays, but I came up with this version to do the same

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2)<6))-SUMPRODUCT(--(COUNTIF
(holidays,ROW(INDIRECT(J1&":"&K1)))0),--(WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2
)<6))

I know you are a formula ace, so I wondered if this can be simplified?

Bob


"Jason Morin" wrote in message
...
And if you can't use NETWORKDAYS because your girlfriend
can't find the Office install CD for her home PC and thus
you can't install the Analysis ToolPak add-in, try:

=SUMPRODUCT(--(LEFT(TEXT(ROW(INDIRECT(J1&":"&K1)),"ddd"))
<"S"))

;-)
HTH
Jason
Atlanta, GA

-----Original Message-----
I need the formula to calculate dates (Mondy to Friday)

without counting the
weekends
.



  #7   Report Post  
Jason Morin
 
Posts: n/a
Default

Bob-

Thanks. Actually, I was going to respond using your exact
formula that uses the typical WEEKDAY method, but decided
to be a little different. You're right though - it does
add another nested function. Harlan Grove would have a fit!
Sometimes I just want to try something new and creative,
even if it is a little less efficient. I think it's
important to explore new methods. While they initially may
be cumbersome and less efficient than the typical "canned"
solution, they are often improved by others (that's why I
love the NGs).

I'm leaving for a party, so I don't have time to play with
the holiday portion, but I like your formula - it's
probably what I would have arrived at. But I'll work on it
later.

As for the girlfriend, using her PC at her house kills me.
Windows 98 (ah!), Excel 2000, and no install CD, and no
VBA help file.

Regards,

Jason

PS - I'm still waiting for those white papers in
your "coming soon" section on your home page, esp. the VBA
Best Practices. I still need a lot of help on my VBA
skills!

-----Original Message-----
Jason,

That's a neat formula, and it has the advantage over

NETWORKDAYS of not
mattering which order you put the dates in (that has

always been an
annoyance of NETWORKDAYS to me). I thought it would be

improved a bit if you
used

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2)<6))

as it doesn't have to do any string matching then, and it

removes one nested
function. Furthermore, it can omit Fridays more easily if

you test for < 5,
or even use an array of allowable days, such as {3,4,5}

(making by beautiful
UDF redundant :-)). The obvious disadvantage is that

NETWORKDAYS can
exclude holidays, but I came up with this version to do

the same

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2)<6))-

SUMPRODUCT(--(COUNTIF
(holidays,ROW(INDIRECT(J1&":"&K1)))0),--(WEEKDAY(ROW

(INDIRECT(J1&":"&K1)),2
)<6))

I know you are a formula ace, so I wondered if this can

be simplified?

Bob


"Jason Morin" wrote

in message
...
And if you can't use NETWORKDAYS because your girlfriend
can't find the Office install CD for her home PC and

thus
you can't install the Analysis ToolPak add-in, try:

=SUMPRODUCT(--(LEFT(TEXT(ROW(INDIRECT

(J1&":"&K1)),"ddd"))
<"S"))

;-)
HTH
Jason
Atlanta, GA

-----Original Message-----
I need the formula to calculate dates (Mondy to Friday)

without counting the
weekends
.



.

  #8   Report Post  
Bob Phillips
 
Posts: n/a
Default


"Jason Morin" wrote in message
...

Sometimes I just want to try something new and creative,
even if it is a little less efficient. I think it's
important to explore new methods. While they initially may
be cumbersome and less efficient than the typical "canned"
solution, they are often improved by others (that's why I
love the NGs).


I agree with you on that. Open the door, and soemone will furnishg the room
:-). And as you say, the NGs are for exploring the options as well as
providing a solution.

I'm leaving for a party, so I don't have time to play with
the holiday portion, but I like your formula - it's
probably what I would have arrived at. But I'll work on it
later.


Lucky you, it's nearly bedtime here. Also, just spotted another thread on a
similar topic, and Domenic provided a formula which is the obvious extension
(read improvement) on mine, which I think is where you would also have taken
it. This is that formula

=SUMPRODUCT((WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2<6) *(1-ISNUMBER(MATCH(ROW(IND
IRECT(J1&":"&K1)),holidays,0))))

which can also use the array of allowable day numbers.

PS - I'm still waiting for those white papers in
your "coming soon" section on your home page, esp. the VBA
Best Practices. I still need a lot of help on my VBA
skills!


Major life changes at the moment have pre-occupied me. I have about 6 papers
to complete, and 3 add-ins, so I need to buckle down :-).

Regards

Bob


  #9   Report Post  
Robert
 
Posts: n/a
Default

Dear Bob, J1=1-Feb-05, K1=4-Feb0-5. Using the formula below,
I get 18 instead of 4. If 3-Feb-05 is entered in "holidays", I get 13.
What error returns those numbers. Note the the formula has an extra")" when
accepting MS suggested prompt over the post by you. Tks


=SUMPRODUCT((WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2<6) *(1-ISNUMBER(MATCH(ROW(INDIRECT(J1&":"&K1)),holidays,0 )))))

  #10   Report Post  
Bob Phillips
 
Posts: n/a
Default

Robert,

Got a bracket out of line. Try this version instead

=SUMPRODUCT((WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2)<6 )*(1-ISNUMBER(MATCH(ROW(IN
DIRECT(J1&":"&K1)),holidays,0))))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Robert" wrote in message
...
Dear Bob, J1=1-Feb-05, K1=4-Feb0-5. Using the formula below,
I get 18 instead of 4. If 3-Feb-05 is entered in "holidays", I get 13.
What error returns those numbers. Note the the formula has an extra")"

when
accepting MS suggested prompt over the post by you. Tks



=SUMPRODUCT((WEEKDAY(ROW(INDIRECT(J1&":"&K1)),2<6) *(1-ISNUMBER(MATCH(ROW(IND
IRECT(J1&":"&K1)),holidays,0)))))



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate work hours between two dates trixiebme Excel Worksheet Functions 1 January 12th 05 07:37 PM
How do I calculate difference in days & hours between two dates e. probi2 Excel Worksheet Functions 1 January 12th 05 03:59 PM
Calculate the number of workdays between 2 dates Tegid77 Excel Worksheet Functions 1 November 4th 04 07:27 PM
counting entries between two dates? Todd Excel Worksheet Functions 7 November 1st 04 11:07 PM
calculate with dates before 1-1-1900 jan wan Excel Worksheet Functions 3 October 29th 04 10:54 PM


All times are GMT +1. The time now is 05:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"