ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using =month(c2) if c2 is blank returns a 1, which messes up data (https://www.excelbanter.com/excel-programming/346348-using-%3Dmonth-c2-if-c2-blank-returns-1-messes-up-data.html)

MHY

using =month(c2) if c2 is blank returns a 1, which messes up data
 


Roger Govier[_10_]

using =month(c2) if c2 is blank returns a 1, which messes updata
 
Hi

A blank cell will be treated as 01/01/1900 if blank and trying to do date
calculations, hence it returns month 1.

You will need to do a check If Isnumber() before carrying out the Month()
function.

Regards

Roger Govier


MHY wrote:

Chip Pearson

using =month(c2) if c2 is blank returns a 1, which messes up data
 
A blank cell will be treated as 01/01/1900

Actually, it is treated as 1/0/1900.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Roger Govier" wrote in message
...
Hi

A blank cell will be treated as 01/01/1900 if blank and trying
to do date calculations, hence it returns month 1.

You will need to do a check If Isnumber() before carrying out
the Month() function.

Regards

Roger Govier


MHY wrote:





All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com