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, if 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, if any Saturday is detected with values in the
corresponding row. I created a 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 String) As Boolean
If Weekday(DateValue(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 - 28 Feb 2007 16:53 GMT
Check your initial post.
> 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
[quoted text clipped - 25 lines]
> Thanks & regards,
> Enzo

Signature
Dave Peterson
Bob Phillips - 28 Feb 2007 16:56 GMT
=IF(SUMPRODUCT(--(WEEKDAY(14:14)=6))>0,SUMPRODUCT(--(WEEKDAY(14:14)=6),16:16))

Signature
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
>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
[quoted text clipped - 25 lines]
> Thanks & regards,
> Enzo
Bob Phillips - 28 Feb 2007 17:16 GMT
I mean =7 not =6

Signature
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
> =IF(SUMPRODUCT(--(WEEKDAY(14:14)=6))>0,SUMPRODUCT(--(WEEKDAY(14:14)=6),16:16))
>
[quoted text clipped - 27 lines]
>> Thanks & regards,
>> Enzo