#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Date and If problem

I am trying to get a cell (B2) to auto fill if a cell on a 2nd
worksheet (H6) contains a date.

I am using in B2

=IF(Report!H6 =" ";"";Report!H6)

If there is a date in H6 then B2 correctly shows as the date, but if
H6 is blank then B2 shows as
00January1900

I have B2 formatted as date, when i do not then the date shows as
465678.

How can i resolve this problem,

With thanks

Bob
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Date and If problem

Hi Bob,

Am Thu, 21 Jun 2012 12:46:58 -0700 (PDT) schrieb Bob:

I am using in B2

=IF(Report!H6 =" ";"";Report!H6)


there is a typo in your formula. If Report!H6=" " means if Report!H6
contains a space. If Report!H6 is empty you get the value of an empty
cell 0 and that's 00. January 1900.
Try:
=IF(Report!H6="","",Report!H6)


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Date and If problem

Claus Busch has brought this to us :
Hi Bob,

Am Thu, 21 Jun 2012 12:46:58 -0700 (PDT) schrieb Bob:

I am using in B2

=IF(Report!H6 =" ";"";Report!H6)


there is a typo in your formula. If Report!H6=" " means if Report!H6
contains a space. If Report!H6 is empty you get the value of an empty
cell 0 and that's 00. January 1900.
Try:
=IF(Report!H6="","",Report!H6)


Regards
Claus Busch


To avoid ambiguity about cells being empty or not, I use...

=NOT(Reort!H6)

...which evaluates to FALSE for the range if it's empty, meaning the
return is TRUE for the formula. So...

=IF(NOT(Report!H6),"",Report!H6)

...which translates that
IF Report!H6 is empty THEN
return an empty string
ELSE
return the value in Report!H6


Alternatively, to check if a cell is not empty...

=IF(LEN(Report!H6),Report!H6,"")

...which translates that
IF Report!H6 is NOT empty THEN
return the value in Report!H6
ELSE
return an empty string

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Date and If problem

sorry about the typo:

To avoid ambiguity about cells being empty or not, I use...

=NOT(Report!H6)

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Date and If problem

Hi Garry,

Am Thu, 21 Jun 2012 17:42:22 -0400 schrieb GS:

To avoid ambiguity about cells being empty or not, I use...

=NOT(Reort!H6)

..which evaluates to FALSE for the range if it's empty, meaning the
return is TRUE for the formula. So...

=IF(NOT(Report!H6),"",Report!H6)

..which translates that
IF Report!H6 is empty THEN
return an empty string
ELSE
return the value in Report!H6

Alternatively, to check if a cell is not empty...

=IF(LEN(Report!H6),Report!H6,"")

..which translates that
IF Report!H6 is NOT empty THEN
return the value in Report!H6
ELSE
return an empty string


good point. I agree.


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Date and If problem

On Jun 21, 10:51*pm, Claus Busch wrote:
Hi Garry,

Am Thu, 21 Jun 2012 17:42:22 -0400 schrieb GS:





To avoid ambiguity about cells being empty or not, I use...


* =NOT(Reort!H6)


..which evaluates to FALSE for the range if it's empty, meaning the
return is TRUE for the formula. So...


* =IF(NOT(Report!H6),"",Report!H6)


..which translates that
* IF Report!H6 is empty THEN
* * return an empty string
* ELSE
* * return the value in Report!H6


Alternatively, to check if a cell is not empty...


* =IF(LEN(Report!H6),Report!H6,"")


..which translates that
* IF Report!H6 is NOT empty THEN
* * return the value in Report!H6
* ELSE
* * return an empty string


good point. I agree.

Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


Thank you gentleman, help is much appreciated.

Bob
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Date and If problem

Claus,
I can't tell you the number of times I found people use the 'Spacebar'
to 'clear contents' from cells. And then they wonder why their calc
formulas suddenly return errors! Hence, I typically change things as
noted to hopefully educate users (OR at the very least persuade them
away from that bad habit).<g

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exel increment date problem wrt todays date. [email protected] Excel Worksheet Functions 1 November 11th 07 06:58 PM
Date Formula Problem - Leave date blank if Null Gayla Excel Worksheet Functions 5 April 24th 07 09:42 PM
Us date versus EU date problem Jan T. Excel Programming 7 October 2nd 06 07:06 PM
Date problem PE Excel Discussion (Misc queries) 1 May 31st 06 11:12 AM
Date Problem Subs Excel Programming 1 October 3rd 05 01:26 PM


All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"