» Avoiding Negative Values when Calculating the Number of Days between Two Dates
CATEGORY - Excel Date & Time Formulas
VERSION - All Microsoft Excel Versions
We want to create a formula to calculate the number of days between each pair of dates in columns A & B, but the formula is never to return a negative value.
Empty cells in column A are to be considered the first day of the year, and empty cells in column B are to be considered the last day of the year.
Solution:
Use the MAX, MIN, and DATE functions as shown in the following formula:
=MIN(B2,DATE(2005,12,31))-MAX(A2,DATE(2005,1,1))
Book Store:
Recommended Books:
- Essentials of Investments with Standard & Poor's Educational Version of Market Insight + PowerWeb + Stock Trak Coupon
- Learn MS Excel 2002 VBA/XML Programming
- Microsoft Excel 2002 Formulas (With CD-ROM)
- Understanding Financial Statements
- Yes, You Can Time the Market!
- The Total Money Makeover. : A Proven Plan for Financial Fitness
No comments have been submitted.

