View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_392_] Rick Rothstein \(MVP - VB\)[_392_] is offline
external usenet poster
 
Posts: 1
Default How to set the value to zero if it negative after the substract

One way...

=MAX(0,(YEAR(B1)-YEAR(C1))*12+MONTH(B1)-MONTH(C1))

Rick


"TSK" wrote in message
...
Please advise

Q1: When applying the formula, D will show -38 but i need excel to change
it
to zero and recongized it as number zero, otherwise when I multiple other
cell with this cell it will give value - Example 1.

Q2: However, I would also need cell D1 to reflect the number if it is not
zero or negative number - Example 2

Example 1

A1 - 01 Mar 2001 (Start Date)
B1 - 01 Mar 2006 (End Date)
C1 - 31 May 2008 (Audit Date)
D1 - (YEAR(B1)-YEAR(C1))*12+MONTH(B1)-MONTH(C1) = 0 instead of -38


Example 2

A1 - 01 Mar 2001 (Start Date)
B1 - 01 Jun 2010 (End Date)
C1 - 31 May 2008 (Audit Date)
D1 - I had this formula in cell D1:
(YEAR(B1)-YEAR(C1))*12+MONTH(B1)-MONTH(C1) = 25