From de3f948b27dfa26faa225db191b89d6c3eb0c963 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 10 Jul 2019 22:41:28 +0200 Subject: [PATCH] Coupnum fix (#1069) * New Unit Tests for COUPNUM() * COUPNUM should not return zero when settlement is in the last period * Additional tests and fixes for COUPNCD() and COUPPCD() functions * Additional tests and fixes for COUPNCD() and COUPPCD() functions --- src/PhpSpreadsheet/Calculation/Financial.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Financial.php b/src/PhpSpreadsheet/Calculation/Financial.php index 12dfa7a7..dde87c1c 100644 --- a/src/PhpSpreadsheet/Calculation/Financial.php +++ b/src/PhpSpreadsheet/Calculation/Financial.php @@ -417,7 +417,7 @@ class Financial return Functions::VALUE(); } - if (($settlement > $maturity) || + if (($settlement >= $maturity) || (!self::isValidFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { return Functions::NAN(); @@ -476,7 +476,7 @@ class Financial return Functions::VALUE(); } - if (($settlement > $maturity) || + if (($settlement >= $maturity) || (!self::isValidFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { return Functions::NAN(); @@ -550,7 +550,7 @@ class Financial return Functions::VALUE(); } - if (($settlement > $maturity) || + if (($settlement >= $maturity) || (!self::isValidFrequency($frequency)) || (($basis < 0) || ($basis > 4))) { return Functions::NAN();