PC Review


Reply
Thread Tools Rate Thread

Arrays, Dates & Blank Cells

 
 
David Lipetz
Guest
Posts: n/a
 
      7th Mar 2008
Folks,

I'm struggling to resolve this Execl formula.

I've got a workbook with 2 sheets: Summary and Source Data. The workbook is
used a template so that data exported from another system can be copied and
pasted into the Source Data sheet and the Summary sheet will
programmatically parse the data to provide the results that I am looking
for.

The Source Data sheet has a number of named ranges. My problem relates to
the range named DATE (D210000). This range contains dates formatted as
"=DATE(2008,1,1)" for Jan 1, 2008 as an example. In virtually every case,
there will be blank cells in the range since the data is less than 10K
rows).

The Summary sheet uses formulas to summarize the data contained in the
Source Data sheet by month, category, and so forth. In cell $B$16, a numeral
(1-12) is entered to specifiy the month for which the records in Source Data
are to be summarized. I then use two formulas that examine the dates in the
DATE range and provide the MIN and MAX date so the date range can be
displayed.

Here are the array formulas I am using to get these MIN and MAX dates:
{=MIN(IF(MONTH(Date)=$B16,Date,"N/A"))}
{=MAX(IF(MONTH(Date)=$B16,Date,"N/A"))}

Here is my problem (assuming that the data in Source Data contains
transactions from 01/01/08 through 03/06/08):

When 1 is entered in $B$16:
MIN returns 0-Jan-00 (INCORRECT - should be 1-Jan-08)
MAX returns 31-Jan-08 (correct)

When 2 is entered in $B$16:
MIN returns 1-Feb-08 (correct)
MAX returns 29-Feb-08 (correct)

When 3 is entered in $B$16:
MIN returns 1-Mar-08 (correct)
MAX returns 6-Mar-08 (correct)

When 4 is entered in $B$16:
MIN returns 0-Jan-00 (INCORRECT - should be N/A)
MAX returns 0-Jan-00 (INCORRECT - should be N/A)

I think that the blank cells in the DATE range are screwing me up but I am
at a loss on how to check for them and also how to report N/A when the month
in $B$16 represents no transactions in the Source Data sheet.

Appreciate any advice.

Thanks,
David


 
Reply With Quote
 
 
 
 
T. Valko
Guest
Posts: n/a
 
      7th Mar 2008
An empty cell will evaluate to month number 1. To account for that:

=MIN(IF((date<>"")*(MONTH(date)=B16),date))

> When 4 is entered in $B$16:
> MIN returns 0-Jan-00 (INCORRECT - should be N/A)
> MAX returns 0-Jan-00 (INCORRECT - should be N/A)


If no dates meet the criteria then the result of those formulas will be 0
and if you have the cell formatted as DATE then you'll get 0-Jan-00. So, you
have to test the result of the formula to see if it is 0:

=IF(MIN(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MIN(IF((date<>"")*(MONTH(date)=B16),date)))

=IF(MAX(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MAX(IF((date<>"")*(MONTH(date)=B16),date)))

All formulas are array entered.


--
Biff
Microsoft Excel MVP


"David Lipetz" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Folks,
>
> I'm struggling to resolve this Execl formula.
>
> I've got a workbook with 2 sheets: Summary and Source Data. The workbook
> is used a template so that data exported from another system can be copied
> and pasted into the Source Data sheet and the Summary sheet will
> programmatically parse the data to provide the results that I am looking
> for.
>
> The Source Data sheet has a number of named ranges. My problem relates to
> the range named DATE (D210000). This range contains dates formatted as
> "=DATE(2008,1,1)" for Jan 1, 2008 as an example. In virtually every case,
> there will be blank cells in the range since the data is less than 10K
> rows).
>
> The Summary sheet uses formulas to summarize the data contained in the
> Source Data sheet by month, category, and so forth. In cell $B$16, a
> numeral (1-12) is entered to specifiy the month for which the records in
> Source Data are to be summarized. I then use two formulas that examine the
> dates in the DATE range and provide the MIN and MAX date so the date range
> can be displayed.
>
> Here are the array formulas I am using to get these MIN and MAX dates:
> {=MIN(IF(MONTH(Date)=$B16,Date,"N/A"))}
> {=MAX(IF(MONTH(Date)=$B16,Date,"N/A"))}
>
> Here is my problem (assuming that the data in Source Data contains
> transactions from 01/01/08 through 03/06/08):
>
> When 1 is entered in $B$16:
> MIN returns 0-Jan-00 (INCORRECT - should be 1-Jan-08)
> MAX returns 31-Jan-08 (correct)
>
> When 2 is entered in $B$16:
> MIN returns 1-Feb-08 (correct)
> MAX returns 29-Feb-08 (correct)
>
> When 3 is entered in $B$16:
> MIN returns 1-Mar-08 (correct)
> MAX returns 6-Mar-08 (correct)
>
> When 4 is entered in $B$16:
> MIN returns 0-Jan-00 (INCORRECT - should be N/A)
> MAX returns 0-Jan-00 (INCORRECT - should be N/A)
>
> I think that the blank cells in the DATE range are screwing me up but I am
> at a loss on how to check for them and also how to report N/A when the
> month in $B$16 represents no transactions in the Source Data sheet.
>
> Appreciate any advice.
>
> Thanks,
> David
>



 
Reply With Quote
 
David Lipetz
Guest
Posts: n/a
 
      7th Mar 2008
Biff,

Outstanding! Thank you.

Please explain the significance of the * in your formula:
=IF(MIN(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MIN(IF((date<>"")*(MONTH(date)=B16),date))).

Does it mean AND? If so, how many *'s can be strung together?

Aside from my question above, I now understand the problem I was having and
how your solution corrects it. Many thanks!

David


"T. Valko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> An empty cell will evaluate to month number 1. To account for that:
>
> =MIN(IF((date<>"")*(MONTH(date)=B16),date))
>
>> When 4 is entered in $B$16:
>> MIN returns 0-Jan-00 (INCORRECT - should be N/A)
>> MAX returns 0-Jan-00 (INCORRECT - should be N/A)

>
> If no dates meet the criteria then the result of those formulas will be 0
> and if you have the cell formatted as DATE then you'll get 0-Jan-00. So,
> you have to test the result of the formula to see if it is 0:
>
> =IF(MIN(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MIN(IF((date<>"")*(MONTH(date)=B16),date)))
>
> =IF(MAX(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MAX(IF((date<>"")*(MONTH(date)=B16),date)))
>
> All formulas are array entered.
>
>
> --
> Biff
> Microsoft Excel MVP
>
>
> "David Lipetz" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Folks,
>>
>> I'm struggling to resolve this Execl formula.
>>
>> I've got a workbook with 2 sheets: Summary and Source Data. The workbook
>> is used a template so that data exported from another system can be
>> copied and pasted into the Source Data sheet and the Summary sheet will
>> programmatically parse the data to provide the results that I am looking
>> for.
>>
>> The Source Data sheet has a number of named ranges. My problem relates to
>> the range named DATE (D210000). This range contains dates formatted as
>> "=DATE(2008,1,1)" for Jan 1, 2008 as an example. In virtually every case,
>> there will be blank cells in the range since the data is less than 10K
>> rows).
>>
>> The Summary sheet uses formulas to summarize the data contained in the
>> Source Data sheet by month, category, and so forth. In cell $B$16, a
>> numeral (1-12) is entered to specifiy the month for which the records in
>> Source Data are to be summarized. I then use two formulas that examine
>> the dates in the DATE range and provide the MIN and MAX date so the date
>> range can be displayed.
>>
>> Here are the array formulas I am using to get these MIN and MAX dates:
>> {=MIN(IF(MONTH(Date)=$B16,Date,"N/A"))}
>> {=MAX(IF(MONTH(Date)=$B16,Date,"N/A"))}
>>
>> Here is my problem (assuming that the data in Source Data contains
>> transactions from 01/01/08 through 03/06/08):
>>
>> When 1 is entered in $B$16:
>> MIN returns 0-Jan-00 (INCORRECT - should be 1-Jan-08)
>> MAX returns 31-Jan-08 (correct)
>>
>> When 2 is entered in $B$16:
>> MIN returns 1-Feb-08 (correct)
>> MAX returns 29-Feb-08 (correct)
>>
>> When 3 is entered in $B$16:
>> MIN returns 1-Mar-08 (correct)
>> MAX returns 6-Mar-08 (correct)
>>
>> When 4 is entered in $B$16:
>> MIN returns 0-Jan-00 (INCORRECT - should be N/A)
>> MAX returns 0-Jan-00 (INCORRECT - should be N/A)
>>
>> I think that the blank cells in the DATE range are screwing me up but I
>> am at a loss on how to check for them and also how to report N/A when the
>> month in $B$16 represents no transactions in the Source Data sheet.
>>
>> Appreciate any advice.
>>
>> Thanks,
>> David
>>

>
>



 
Reply With Quote
 
T. Valko
Guest
Posts: n/a
 
      7th Mar 2008
> Please explain the significance of the * in your formula:
> Does it mean AND?


Yes

>how many *'s can be strung together?


As many as you want as long as the formula doesn't exceed the length limit
(Excel version dependent).


--
Biff
Microsoft Excel MVP


"David Lipetz" <(E-Mail Removed)> wrote in message
news:e4VN%(E-Mail Removed)...
> Biff,
>
> Outstanding! Thank you.
>
> Please explain the significance of the * in your formula:
> =IF(MIN(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MIN(IF((date<>"")*(MONTH(date)=B16),date))).
>
> Does it mean AND? If so, how many *'s can be strung together?
>
> Aside from my question above, I now understand the problem I was having
> and how your solution corrects it. Many thanks!
>
> David
>
>
> "T. Valko" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> An empty cell will evaluate to month number 1. To account for that:
>>
>> =MIN(IF((date<>"")*(MONTH(date)=B16),date))
>>
>>> When 4 is entered in $B$16:
>>> MIN returns 0-Jan-00 (INCORRECT - should be N/A)
>>> MAX returns 0-Jan-00 (INCORRECT - should be N/A)

>>
>> If no dates meet the criteria then the result of those formulas will be 0
>> and if you have the cell formatted as DATE then you'll get 0-Jan-00. So,
>> you have to test the result of the formula to see if it is 0:
>>
>> =IF(MIN(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MIN(IF((date<>"")*(MONTH(date)=B16),date)))
>>
>> =IF(MAX(IF((date<>"")*(MONTH(date)=B16),date))=0,"N/A",MAX(IF((date<>"")*(MONTH(date)=B16),date)))
>>
>> All formulas are array entered.
>>
>>
>> --
>> Biff
>> Microsoft Excel MVP
>>
>>
>> "David Lipetz" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Folks,
>>>
>>> I'm struggling to resolve this Execl formula.
>>>
>>> I've got a workbook with 2 sheets: Summary and Source Data. The workbook
>>> is used a template so that data exported from another system can be
>>> copied and pasted into the Source Data sheet and the Summary sheet will
>>> programmatically parse the data to provide the results that I am looking
>>> for.
>>>
>>> The Source Data sheet has a number of named ranges. My problem relates
>>> to the range named DATE (D210000). This range contains dates formatted
>>> as "=DATE(2008,1,1)" for Jan 1, 2008 as an example. In virtually every
>>> case, there will be blank cells in the range since the data is less than
>>> 10K rows).
>>>
>>> The Summary sheet uses formulas to summarize the data contained in the
>>> Source Data sheet by month, category, and so forth. In cell $B$16, a
>>> numeral (1-12) is entered to specifiy the month for which the records in
>>> Source Data are to be summarized. I then use two formulas that examine
>>> the dates in the DATE range and provide the MIN and MAX date so the date
>>> range can be displayed.
>>>
>>> Here are the array formulas I am using to get these MIN and MAX dates:
>>> {=MIN(IF(MONTH(Date)=$B16,Date,"N/A"))}
>>> {=MAX(IF(MONTH(Date)=$B16,Date,"N/A"))}
>>>
>>> Here is my problem (assuming that the data in Source Data contains
>>> transactions from 01/01/08 through 03/06/08):
>>>
>>> When 1 is entered in $B$16:
>>> MIN returns 0-Jan-00 (INCORRECT - should be 1-Jan-08)
>>> MAX returns 31-Jan-08 (correct)
>>>
>>> When 2 is entered in $B$16:
>>> MIN returns 1-Feb-08 (correct)
>>> MAX returns 29-Feb-08 (correct)
>>>
>>> When 3 is entered in $B$16:
>>> MIN returns 1-Mar-08 (correct)
>>> MAX returns 6-Mar-08 (correct)
>>>
>>> When 4 is entered in $B$16:
>>> MIN returns 0-Jan-00 (INCORRECT - should be N/A)
>>> MAX returns 0-Jan-00 (INCORRECT - should be N/A)
>>>
>>> I think that the blank cells in the DATE range are screwing me up but I
>>> am at a loss on how to check for them and also how to report N/A when
>>> the month in $B$16 represents no transactions in the Source Data sheet.
>>>
>>> Appreciate any advice.
>>>
>>> Thanks,
>>> David
>>>

>>
>>

>
>



 
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
Conditional Formatting - Dates & Blank Cells Pat Microsoft Excel Misc 4 26th Feb 2010 04:44 PM
COUNTIF q re dates and blank cells Jock Microsoft Excel Worksheet Functions 4 27th Mar 2008 12:38 PM
Vlookup on blank cells formatted with dates =?Utf-8?B?QXlzZQ==?= Microsoft Excel Misc 3 18th Jul 2007 03:42 PM
dates leave cells blank Gary Microsoft Excel Discussion 4 11th May 2007 02:05 AM
vba arrays, count blank cells matt Microsoft Excel Programming 2 14th Dec 2006 10:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:57 AM.