Microsoft KB Archive/51303

From BetaArchive Wiki



Excel: DAY() Function Returns 1 When Referencing Blank Cell

Last reviewed: November 2, 1994
Article ID: Q51303



1.00 1.03 1.04 1.06 1.50 2.20 3.00 4.00 MACINTOSH

SUMMARY

In Microsoft Excel, a value of 1 will be returned to the =DAY(cell_reference) function if "cell_reference" is a blank cell. This value is returned because a blank cell is equal to 0 (zero) and a zero serial date on the Macintosh is January 1, 1904; therefore, =DAY(0) equals 1.

MORE INFORMATION

This situation can result in the first day of the month appearing equal to a blank cell, as shown in the following example:

   =IF(DAY(A1)<>DAY(NOW()),"Not Equal","Equal")

If A1 is blank, DAY(A1) returns 1. If NOW() is the first day of the month, DAY(NOW()) returns 1.

"Equal" is returned, even though cell A1 is blank.

To see if A1 is blank, use the following formula:

   =IF(A1="","Not Equal",IF(DAY(A1)<>DAY(NOW()),"Not Equal","Equal"))



KBCategory: kbother

KBSubcategory:

Additional reference words: 2.20 2.2 3.0 3.00 4.0 4.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.