View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
TSK TSK is offline
external usenet poster
 
Posts: 21
Default How to set the value to zero if it negative after the substrac

Thank you Rick.

Can you advise the how to set the value to zero on the following example

Example

Cell D - 0
Cell E - 0
Cell F - Reflect 0 instead of #DIV/0! when cell E/Cell D

"Rick Rothstein (MVP - VB)" wrote:

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