PC Review


Reply
Thread Tools Rate Thread

Counting contents for Saturday dates within a range

 
 
Enz
Guest
Posts: n/a
 
      28th Feb 2007
I am trying to find all Saturdays within a range(on row 14), and if a
Saturday is detected, then I would like to add the values in the
corresponding row for the Saturday only dates(available in row 16).
After going through the date range, and the total sum is zero, then I
would like to return false. I also am trying to avoid doing this via
a macro as it should be automatically re-calculated if a cell changes.

Currently I have the cell formatted as follows that will provide a
true or false response, if any Saturday is detected with values in the
corresponding row. I created an IsSaturday function, that seems to be
returning #value. The result is that the formula always produces the
result of false.

=IF(SUMIF($C$14:$AG$14,IsSaturday(),C16:AG16)<>0, TRUE, FALSE)

Below is the function I have coded:

Public Function IsSaturday(x As Date) As Boolean

If Weekday(x) = 7 Then
IsSaturday = True
Else
IsSaturday = False
End Function

Is there something I am missing here, or can it be done a better way?

Thanks & regards,
Enzo

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      28th Feb 2007
How about:

=SUMPRODUCT(--(WEEKDAY($C$14:$AG$14)=7),--($C$16:$AG$16<>0))>0

(I added $ to the stuff on row 16)

(Your udf would have to be rewritten to process a range of dates and return an
array of 1/0's or true/falses.)

Enz wrote:
>
> I am trying to find all Saturdays within a range(on row 14), and if a
> Saturday is detected, then I would like to add the values in the
> corresponding row for the Saturday only dates(available in row 16).
> After going through the date range, and the total sum is zero, then I
> would like to return false. I also am trying to avoid doing this via
> a macro as it should be automatically re-calculated if a cell changes.
>
> Currently I have the cell formatted as follows that will provide a
> true or false response, if any Saturday is detected with values in the
> corresponding row. I created an IsSaturday function, that seems to be
> returning #value. The result is that the formula always produces the
> result of false.
>
> =IF(SUMIF($C$14:$AG$14,IsSaturday(),C16:AG16)<>0, TRUE, FALSE)
>
> Below is the function I have coded:
>
> Public Function IsSaturday(x As Date) As Boolean
>
> If Weekday(x) = 7 Then
> IsSaturday = True
> Else
> IsSaturday = False
> End Function
>
> Is there something I am missing here, or can it be done a better way?
>
> Thanks & regards,
> Enzo


--

Dave Peterson
 
Reply With Quote
 
Enz
Guest
Posts: n/a
 
      28th Feb 2007
On Feb 28, 11:34 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> How about:
>
> =SUMPRODUCT(--(WEEKDAY($C$14:$AG$14)=7),--($C$16:$AG$16<>0))>0
>
> (I added $ to the stuff on row 16)
>
> (Your udf would have to be rewritten to process a range of dates and return an
> array of 1/0's or true/falses.)
>
>
>
>
>
> Enz wrote:
>
> > I am trying to find all Saturdays within a range(on row 14), and if a
> > Saturday is detected, then I would like to add the values in the
> > corresponding row for the Saturday only dates(available in row 16).
> > After going through the date range, and the total sum is zero, then I
> > would like to return false. I also am trying to avoid doing this via
> > a macro as it should be automatically re-calculated if a cell changes.

>
> > Currently I have the cell formatted as follows that will provide a
> > true or false response, if any Saturday is detected with values in the
> > corresponding row. I created an IsSaturday function, that seems to be
> > returning #value. The result is that the formula always produces the
> > result of false.

>
> > =IF(SUMIF($C$14:$AG$14,IsSaturday(),C16:AG16)<>0, TRUE, FALSE)

>
> > Below is the function I have coded:

>
> > Public Function IsSaturday(x As Date) As Boolean

>
> > If Weekday(x) = 7 Then
> > IsSaturday = True
> > Else
> > IsSaturday = False
> > End Function

>
> > Is there something I am missing here, or can it be done a better way?

>
> > Thanks & regards,
> > Enzo

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -


This does not seem to work, as the weekday works on a date as opposed
to a range of dates. I will have a look at what I might be able to do
with SUMPRODUCT or other functions. thanks,

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Feb 2007
You sure?

I'd try it once more.

Enz wrote:
>
> On Feb 28, 11:34 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > How about:
> >
> > =SUMPRODUCT(--(WEEKDAY($C$14:$AG$14)=7),--($C$16:$AG$16<>0))>0
> >
> > (I added $ to the stuff on row 16)
> >
> > (Your udf would have to be rewritten to process a range of dates and return an
> > array of 1/0's or true/falses.)
> >
> >
> >
> >
> >
> > Enz wrote:
> >
> > > I am trying to find all Saturdays within a range(on row 14), and if a
> > > Saturday is detected, then I would like to add the values in the
> > > corresponding row for the Saturday only dates(available in row 16).
> > > After going through the date range, and the total sum is zero, then I
> > > would like to return false. I also am trying to avoid doing this via
> > > a macro as it should be automatically re-calculated if a cell changes.

> >
> > > Currently I have the cell formatted as follows that will provide a
> > > true or false response, if any Saturday is detected with values in the
> > > corresponding row. I created an IsSaturday function, that seems to be
> > > returning #value. The result is that the formula always produces the
> > > result of false.

> >
> > > =IF(SUMIF($C$14:$AG$14,IsSaturday(),C16:AG16)<>0, TRUE, FALSE)

> >
> > > Below is the function I have coded:

> >
> > > Public Function IsSaturday(x As Date) As Boolean

> >
> > > If Weekday(x) = 7 Then
> > > IsSaturday = True
> > > Else
> > > IsSaturday = False
> > > End Function

> >
> > > Is there something I am missing here, or can it be done a better way?

> >
> > > Thanks & regards,
> > > Enzo

> >
> > --
> >
> > Dave Peterson- Hide quoted text -
> >
> > - Show quoted text -

>
> This does not seem to work, as the weekday works on a date as opposed
> to a range of dates. I will have a look at what I might be able to do
> with SUMPRODUCT or other functions. thanks,


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting dates within a range towem3 Microsoft Excel Worksheet Functions 1 27th Apr 2010 05:23 PM
Sum corresponding row values for Saturday only dates within a date range Enz Microsoft Excel Discussion 3 28th Feb 2007 05:16 PM
Sum corresponding row values for Saturday only dates within a date range Enz Microsoft Excel Discussion 0 28th Feb 2007 04:30 PM
Re: Counting dates within a specified range Trevor Shuttleworth Microsoft Excel Misc 0 7th Dec 2006 10:00 PM
Counting Dates in a Range =?Utf-8?B?TWF0dDcxMDI=?= Microsoft Excel Misc 9 13th Jan 2006 11:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:08 PM.