Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Nested IF formula question

I am currently using the formula below to calculate difference in dates in
Excel 2003 where C4 = start date and D4 = completion date. How can I
suppress any "0" in the responses. For example if the result is only 21 days
then I do not want to show 0 years , 0 months. I will always want to show
days.

=DATEDIF(C4,D4,"y")&" years, "& DATEDIF(C4,D4,"ym")&" months, "&
DATEDIF(C4,D4,"md")&" days"

Thank you for your time.
--
Radrays
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default Nested IF formula question

=IF(DATEDIF(C4,D4,"y")=0,"",DATEDIF(C4,D4,"y")&" years, ")
&IF(DATEDIF(C4,D4,"ym")=0,"",DATEDIF(C4,D4,"ym" )&" months, ")
&IF(DATEDIF(C4,D4,"md")=0,"",DATEDIF(C4,D4,"md" )&" days")


--
__________________________________
HTH

Bob

"Radrays" wrote in message
...
I am currently using the formula below to calculate difference in dates in
Excel 2003 where C4 = start date and D4 = completion date. How can I
suppress any "0" in the responses. For example if the result is only 21
days
then I do not want to show 0 years , 0 months. I will always want to show
days.

=DATEDIF(C4,D4,"y")&" years, "& DATEDIF(C4,D4,"ym")&" months, "&
DATEDIF(C4,D4,"md")&" days"

Thank you for your time.
--
Radrays



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,059
Default Nested IF formula question

On Feb 24, 2:59 pm, Radrays wrote:
How can I suppress any "0" in the responses. For example if
the result is only 21 days then I do not want to show 0 years,
0 months. I will always want to show days.


IMHO, it would be easier if you put the individual DATEDIF expressions
in cells (which you can hide). Then you could write:

=if(Y1,Y1&" years, ","") & if(Y2,Y2&" months, ","") & datedif
(C4,D4,"md")&" days"

But if you insist on a single cell for everything, replace Y1 with
DATEDIF(C4,D4,"y") and Y2 with DATEDIF(C4,D4,"ym") in all places.

HTH.


----- original posting -----

On Feb 24, 2:59*pm, Radrays wrote:
I am currently using the formula below to calculate difference in dates in
Excel 2003 where C4 = start date and D4 = completion date. *How can I
suppress any "0" in the responses. *For example if the result is only 21 days
then I do not want to show 0 years , 0 months. *I will always want to show
days.

=DATEDIF(C4,D4,"y")&" years, "& DATEDIF(C4,D4,"ym")&" months, "&
DATEDIF(C4,D4,"md")&" days"

Thank you for your time.
--
Radrays


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Nested IF formula question

Thanks Bob - worked perfect! Appreciate your time.

"Bob Phillips" wrote:

=IF(DATEDIF(C4,D4,"y")=0,"",DATEDIF(C4,D4,"y")&" years, ")
&IF(DATEDIF(C4,D4,"ym")=0,"",DATEDIF(C4,D4,"ym" )&" months, ")
&IF(DATEDIF(C4,D4,"md")=0,"",DATEDIF(C4,D4,"md" )&" days")


--
__________________________________
HTH

Bob

"Radrays" wrote in message
...
I am currently using the formula below to calculate difference in dates in
Excel 2003 where C4 = start date and D4 = completion date. How can I
suppress any "0" in the responses. For example if the result is only 21
days
then I do not want to show 0 years , 0 months. I will always want to show
days.

=DATEDIF(C4,D4,"y")&" years, "& DATEDIF(C4,D4,"ym")&" months, "&
DATEDIF(C4,D4,"md")&" days"

Thank you for your time.
--
Radrays




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
Nested if formula question phd4212 Excel Discussion (Misc queries) 3 February 25th 09 08:32 AM
Easy Nested IF formula question, please help Seanzie Excel Worksheet Functions 3 January 31st 06 09:36 AM
I get error with "ROWS" in the formula - nested formula question Marie J-son Excel Worksheet Functions 0 January 4th 06 01:55 PM
Excel nested IF formula question [email protected] Excel Discussion (Misc queries) 6 November 10th 05 05:11 PM
large formula question - Max nested functions PCLIVE Excel Worksheet Functions 3 October 17th 05 04:20 PM


All times are GMT +1. The time now is 02:27 PM.

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

About Us

"It's about Microsoft Excel"