Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Kevin
 
Posts: n/a
Default Formula doesnt work

I will be putting dates into cells in column A and B. I will use Row1 as
the reference for my question.
If I have dates in A1 and B1 I need to calculate the number of intervening
months - I used =Datedif(a1,b1,"m"). If both cells are empty, I the number
zero is returned. If one cell is empty, I get #Num. If both are populated,
I get the correct answer.
I want to supress both the 0 and the #num. I tried
=if(iserror(and(isblank(a1),isblank(b1)),"",datedi f((a1,b1,m)),"",if(and(isblank(a1),isblank(b1)),"" ,datedif((a1,b1,m)))

It doesnt work, and I can not figure out what is wrong.

Please help.
  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

One way

=IF(OR(A1="",B1=""),"",DATEDIF(A1,B1,"m"))

--


Regards,

Peo Sjoblom


"Kevin" <ksorei at yahoo.com wrote in message
...
I will be putting dates into cells in column A and B. I will use Row1 as
the reference for my question.
If I have dates in A1 and B1 I need to calculate the number of intervening
months - I used =Datedif(a1,b1,"m"). If both cells are empty, I the
number
zero is returned. If one cell is empty, I get #Num. If both are
populated,
I get the correct answer.
I want to supress both the 0 and the #num. I tried
=if(iserror(and(isblank(a1),isblank(b1)),"",datedi f((a1,b1,m)),"",if(and(isblank(a1),isblank(b1)),"" ,datedif((a1,b1,m)))

It doesnt work, and I can not figure out what is wrong.

Please help.



  #3   Report Post  
Kevin
 
Posts: n/a
Default

it was indeed my logic. Switching from And to Or makes the world a
wonderful place.
Thank you

"Peo Sjoblom" wrote:

One way

=IF(OR(A1="",B1=""),"",DATEDIF(A1,B1,"m"))

--


Regards,

Peo Sjoblom


"Kevin" <ksorei at yahoo.com wrote in message
...
I will be putting dates into cells in column A and B. I will use Row1 as
the reference for my question.
If I have dates in A1 and B1 I need to calculate the number of intervening
months - I used =Datedif(a1,b1,"m"). If both cells are empty, I the
number
zero is returned. If one cell is empty, I get #Num. If both are
populated,
I get the correct answer.
I want to supress both the 0 and the #num. I tried
=if(iserror(and(isblank(a1),isblank(b1)),"",datedi f((a1,b1,m)),"",if(and(isblank(a1),isblank(b1)),"" ,datedif((a1,b1,m)))

It doesnt work, and I can not figure out what is wrong.

Please help.




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
4 Day Work Week in a formula EasleyK Excel Discussion (Misc queries) 1 January 29th 05 06:15 AM
Excel 97 - Adding Every 8th Row - Formula should work, but doesn't Damaeus Excel Worksheet Functions 12 January 23rd 05 04:52 PM
formula won't work tink13ub Excel Worksheet Functions 1 January 17th 05 06:59 AM
formula won't work Linette Excel Worksheet Functions 0 January 17th 05 06:05 AM
formula from Excel97 doesn't work in Excel2003,any ideas why? nic Excel Worksheet Functions 6 November 8th 04 04:40 PM


All times are GMT +1. The time now is 03:57 PM.

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"