Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default counting weekends

Hi-
I have a spreadsheet with 1st column being numerical dates of the
year. Second column contains initials of person on call for the
corresponding date. Same person is on call for Friday, Saturday, and
Sunday (weekend on call). I am unsuccessfully trying to write VB code
to calculate how many weekends (not the total days) each person (by
initials) is on call. (Spreadsheet has several yrs of dates, and
people complaining that they have more weekends of call than someone
else)

TIA

CLS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default counting weekends

Why use VBA.

Assuming dates in column A, people in column B

=SUMPRODUCT((WEEKDAY(A1:A1000)=6)*(B1:B1000="Steve "))

counts how many Fridays Steve has worked, so how many weekends.
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"bluestone" wrote in message
om...
Hi-
I have a spreadsheet with 1st column being numerical dates of the
year. Second column contains initials of person on call for the
corresponding date. Same person is on call for Friday, Saturday, and
Sunday (weekend on call). I am unsuccessfully trying to write VB code
to calculate how many weekends (not the total days) each person (by
initials) is on call. (Spreadsheet has several yrs of dates, and
people complaining that they have more weekends of call than someone
else)

TIA

CLS



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default counting weekends

Just count the Fridays.
=sumproduct(-($B$1:$B$2000="initials"),-(Weekday($A$1:$A$2000,1)=6)

You can replace "initials" with a cell that contains the person's initials
so you can copy the formula down next to a list of initials.

--
Regards,
Tom Ogilvy



"bluestone" wrote in message
om...
Hi-
I have a spreadsheet with 1st column being numerical dates of the
year. Second column contains initials of person on call for the
corresponding date. Same person is on call for Friday, Saturday, and
Sunday (weekend on call). I am unsuccessfully trying to write VB code
to calculate how many weekends (not the total days) each person (by
initials) is on call. (Spreadsheet has several yrs of dates, and
people complaining that they have more weekends of call than someone
else)

TIA

CLS



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
Counting dates but excluding weekends Sara Excel Worksheet Functions 3 August 12th 08 11:28 AM
Exclude weekends when counting days only on day 29 or 30 Loren A - Huntley, Illinois Excel Worksheet Functions 3 February 19th 08 09:18 PM
Weekends Bob[_6_] Excel Worksheet Functions 9 June 8th 07 01:30 PM
Subtact 2 dates to get the number without counting weekends? kjc Excel Worksheet Functions 5 January 23rd 07 06:49 AM
How to Calculate Dates without counting the weekends Lillian F Excel Worksheet Functions 9 January 24th 05 09:09 AM


All times are GMT +1. The time now is 03:59 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"