Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Counting depending on another column

I am trying to count the number fo weekdays (Sun-Thu) and weekends (Fri-Sat).
I have two columns. A -- Date, B -- Day of Week (DOW). They are not linked
in any way.

Countif would work easily if the sheet was setup normally. However, the DOW
is static (Sun-Sat 5 times + Sun, Mon, Tue to cover every possible monthly
combination) and the Dates move depending on the month and when it starts. So
there are always DOWs that are blank in column A.

So how do I count the true number of weekdays and weekends? Feels like it
should be something like IF column A has values, THEN countif column B is
Fri/Sat or something like that.


Thanks for all your help in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 457
Default Counting depending on another column

To count weekdays:
=SUMPRODUCT(--(ISNUMBER(A2:A10)),--(ISNUMBER(MATCH(B2:B10,{"Sun","Mon","Tue","Wed","T hu"},0))))

Weekends:
=SUMPRODUCT(--(ISNUMBER(A2:A10)),--(ISNUMBER(MATCH(B2:B10,{"Fri","Sat"},0))))

Alternatively, can you make column B:
=IF(ISNUMBER(A2),TEXT(A2,"ddd"),"")

Then you could just do a simple COUNTIF
--
Best Regards,

Luke M
"Sungibungi" wrote in message
...
I am trying to count the number fo weekdays (Sun-Thu) and weekends
(Fri-Sat).
I have two columns. A -- Date, B -- Day of Week (DOW). They are not
linked
in any way.

Countif would work easily if the sheet was setup normally. However, the
DOW
is static (Sun-Sat 5 times + Sun, Mon, Tue to cover every possible monthly
combination) and the Dates move depending on the month and when it starts.
So
there are always DOWs that are blank in column A.

So how do I count the true number of weekdays and weekends? Feels like it
should be something like IF column A has values, THEN countif column B is
Fri/Sat or something like that.


Thanks for all your help in advance.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Counting depending on another column

Excellent. That formula works out real well.

If I may ask a question, what is the -- in front of (isnumber)? What does
that do to the formula?

Thanks so much for your help.


Sung


"Luke M" wrote:

To count weekdays:
=SUMPRODUCT(--(ISNUMBER(A2:A10)),--(ISNUMBER(MATCH(B2:B10,{"Sun","Mon","Tue","Wed","T hu"},0))))

Weekends:
=SUMPRODUCT(--(ISNUMBER(A2:A10)),--(ISNUMBER(MATCH(B2:B10,{"Fri","Sat"},0))))

Alternatively, can you make column B:
=IF(ISNUMBER(A2),TEXT(A2,"ddd"),"")

Then you could just do a simple COUNTIF
--
Best Regards,

Luke M
"Sungibungi" wrote in message
...
I am trying to count the number fo weekdays (Sun-Thu) and weekends
(Fri-Sat).
I have two columns. A -- Date, B -- Day of Week (DOW). They are not
linked
in any way.

Countif would work easily if the sheet was setup normally. However, the
DOW
is static (Sun-Sat 5 times + Sun, Mon, Tue to cover every possible monthly
combination) and the Dates move depending on the month and when it starts.
So
there are always DOWs that are blank in column A.

So how do I count the true number of weekdays and weekends? Feels like it
should be something like IF column A has values, THEN countif column B is
Fri/Sat or something like that.


Thanks for all your help in advance.



.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default Counting depending on another column

If I may ask a question, what is the -- in front of (isnumber)?

It converts the Boolean TRUE or FALSE values to their numeric
equivalents, 1 and 0, so they can be used in arithmetic by the
SUMPRODUCT function. The double negation is in effect multiplying the
value by -1 twice, and since -1 * -1 = 1, the value doesn't change.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Fri, 5 Mar 2010 11:51:01 -0800, Sungibungi
wrote:

Excellent. That formula works out real well.

If I may ask a question, what is the -- in front of (isnumber)? What does
that do to the formula?

Thanks so much for your help.


Sung


"Luke M" wrote:

To count weekdays:
=SUMPRODUCT(--(ISNUMBER(A2:A10)),--(ISNUMBER(MATCH(B2:B10,{"Sun","Mon","Tue","Wed","T hu"},0))))

Weekends:
=SUMPRODUCT(--(ISNUMBER(A2:A10)),--(ISNUMBER(MATCH(B2:B10,{"Fri","Sat"},0))))

Alternatively, can you make column B:
=IF(ISNUMBER(A2),TEXT(A2,"ddd"),"")

Then you could just do a simple COUNTIF
--
Best Regards,

Luke M
"Sungibungi" wrote in message
...
I am trying to count the number fo weekdays (Sun-Thu) and weekends
(Fri-Sat).
I have two columns. A -- Date, B -- Day of Week (DOW). They are not
linked
in any way.

Countif would work easily if the sheet was setup normally. However, the
DOW
is static (Sun-Sat 5 times + Sun, Mon, Tue to cover every possible monthly
combination) and the Dates move depending on the month and when it starts.
So
there are always DOWs that are blank in column A.

So how do I count the true number of weekdays and weekends? Feels like it
should be something like IF column A has values, THEN countif column B is
Fri/Sat or something like that.


Thanks for all your help in advance.



.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 42
Default Counting depending on another column

One more alternate with sum and countif

for week days
=SUM(COUNTIFS(A2:A39,"<"&"",B2:B39,{"sun","mon"," tue","wed","thu"}))

For week ends =SUM(COUNTIFS(A2:A39,"<"&"",B2:B39,{"fri","sat"}) )

Vijay

"Sungibungi" wrote:

I am trying to count the number fo weekdays (Sun-Thu) and weekends (Fri-Sat).
I have two columns. A -- Date, B -- Day of Week (DOW). They are not linked
in any way.

Countif would work easily if the sheet was setup normally. However, the DOW
is static (Sun-Sat 5 times + Sun, Mon, Tue to cover every possible monthly
combination) and the Dates move depending on the month and when it starts. So
there are always DOWs that are blank in column A.

So how do I count the true number of weekdays and weekends? Feels like it
should be something like IF column A has values, THEN countif column B is
Fri/Sat or something like that.


Thanks for all your help in advance.

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
Sum values in a column depending on start time in another column Morgan New Users to Excel 5 October 26th 09 01:02 AM
Counting depending on kind of letters FC Excel Discussion (Misc queries) 2 April 23rd 07 10:30 AM
How do I highlight a column depending on other column value? Ada Excel Worksheet Functions 2 July 12th 06 05:49 PM
Counting cell depending on certain crieteria starguy Excel Discussion (Misc queries) 4 April 24th 06 09:05 AM
counting rows depending on 2 selective values Acid-Sky Excel Discussion (Misc queries) 1 September 1st 05 05:45 PM


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