| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2012-03-03 21:08:29 +00:00
										 |  |  |  * Copyright (c) 2006 - 2012 PHPExcel | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This library is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License as published by the Free Software Foundation; either | 
					
						
							|  |  |  |  * version 2.1 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This library is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 
					
						
							|  |  |  |  * Lesser General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Lesser General Public | 
					
						
							|  |  |  |  * License along with this library; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category	PHPExcel | 
					
						
							|  |  |  |  * @package		PHPExcel_Calculation | 
					
						
							| 
									
										
										
										
											2012-03-03 21:08:29 +00:00
										 |  |  |  * @copyright	Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  |  * @license		http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL | 
					
						
							|  |  |  |  * @version		##VERSION##, ##DATE##
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** PHPExcel root directory */ | 
					
						
							|  |  |  | if (!defined('PHPEXCEL_ROOT')) { | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @ignore | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); | 
					
						
							|  |  |  | 	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * PHPExcel_Calculation_Logical | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category	PHPExcel | 
					
						
							|  |  |  |  * @package		PHPExcel_Calculation | 
					
						
							| 
									
										
										
										
											2012-03-03 21:08:29 +00:00
										 |  |  |  * @copyright	Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | class PHPExcel_Calculation_Logical { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * TRUE | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Returns the boolean TRUE. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=TRUE() | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @return	boolean		True | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public static function TRUE() { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		return TRUE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	}	//	function TRUE()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * FALSE | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Returns the boolean FALSE. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=FALSE() | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @return	boolean		False | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public static function FALSE() { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		return FALSE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	}	//	function FALSE()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * LOGICAL_AND | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=AND(logical1[,logical2[, ...]]) | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays | 
					
						
							|  |  |  | 	 *			or references that contain logical values. | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		Boolean arguments are treated as True or False as appropriate | 
					
						
							|  |  |  | 	 *		Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False | 
					
						
							|  |  |  | 	 *		If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
 | 
					
						
							|  |  |  | 	 *			the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @param	mixed		$arg,...		Data values | 
					
						
							|  |  |  | 	 * @return	boolean		The logical AND of the arguments. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public static function LOGICAL_AND() { | 
					
						
							|  |  |  | 		// Return value
 | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		$returnValue = TRUE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Loop through the arguments
 | 
					
						
							|  |  |  | 		$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		$argCount = -1; | 
					
						
							|  |  |  | 		foreach ($aArgs as $argCount => $arg) { | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 			// Is it a boolean value?
 | 
					
						
							|  |  |  | 			if (is_bool($arg)) { | 
					
						
							|  |  |  | 				$returnValue = $returnValue && $arg; | 
					
						
							|  |  |  | 			} elseif ((is_numeric($arg)) && (!is_string($arg))) { | 
					
						
							|  |  |  | 				$returnValue = $returnValue && ($arg != 0); | 
					
						
							|  |  |  | 			} elseif (is_string($arg)) { | 
					
						
							|  |  |  | 				$arg = strtoupper($arg); | 
					
						
							|  |  |  | 				if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 					$arg = TRUE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 				} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 					$arg = FALSE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 				} else { | 
					
						
							|  |  |  | 					return PHPExcel_Calculation_Functions::VALUE(); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				$returnValue = $returnValue && ($arg != 0); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Return
 | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		if ($argCount < 0) { | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 			return PHPExcel_Calculation_Functions::VALUE(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return $returnValue; | 
					
						
							|  |  |  | 	}	//	function LOGICAL_AND()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * LOGICAL_OR | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=OR(logical1[,logical2[, ...]]) | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays | 
					
						
							|  |  |  | 	 *			or references that contain logical values. | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		Boolean arguments are treated as True or False as appropriate | 
					
						
							|  |  |  | 	 *		Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False | 
					
						
							|  |  |  | 	 *		If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
 | 
					
						
							|  |  |  | 	 *			the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @param	mixed		$arg,...		Data values | 
					
						
							|  |  |  | 	 * @return	boolean		The logical OR of the arguments. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public static function LOGICAL_OR() { | 
					
						
							|  |  |  | 		// Return value
 | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		$returnValue = FALSE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Loop through the arguments
 | 
					
						
							|  |  |  | 		$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		$argCount = -1; | 
					
						
							|  |  |  | 		foreach ($aArgs as $argCount => $arg) { | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 			// Is it a boolean value?
 | 
					
						
							|  |  |  | 			if (is_bool($arg)) { | 
					
						
							|  |  |  | 				$returnValue = $returnValue || $arg; | 
					
						
							|  |  |  | 			} elseif ((is_numeric($arg)) && (!is_string($arg))) { | 
					
						
							|  |  |  | 				$returnValue = $returnValue || ($arg != 0); | 
					
						
							|  |  |  | 			} elseif (is_string($arg)) { | 
					
						
							|  |  |  | 				$arg = strtoupper($arg); | 
					
						
							|  |  |  | 				if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 					$arg = TRUE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 				} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 					$arg = FALSE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 				} else { | 
					
						
							|  |  |  | 					return PHPExcel_Calculation_Functions::VALUE(); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				$returnValue = $returnValue || ($arg != 0); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Return
 | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		if ($argCount < 0) { | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 			return PHPExcel_Calculation_Functions::VALUE(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return $returnValue; | 
					
						
							|  |  |  | 	}	//	function LOGICAL_OR()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * NOT | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Returns the boolean inverse of the argument. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=NOT(logical) | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		The argument must evaluate to a logical value such as TRUE or FALSE | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		Boolean arguments are treated as True or False as appropriate | 
					
						
							|  |  |  | 	 *		Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False | 
					
						
							|  |  |  | 	 *		If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
 | 
					
						
							|  |  |  | 	 *			the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @param	mixed		$logical	A value or expression that can be evaluated to TRUE or FALSE | 
					
						
							|  |  |  | 	 * @return	boolean		The boolean inverse of the argument. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 	public static function NOT($logical=FALSE) { | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 		$logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical); | 
					
						
							|  |  |  | 		if (is_string($logical)) { | 
					
						
							|  |  |  | 			$logical = strtoupper($logical); | 
					
						
							|  |  |  | 			if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 				return FALSE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 			} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) { | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 				return TRUE; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 			} else { | 
					
						
							|  |  |  | 				return PHPExcel_Calculation_Functions::VALUE(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return !$logical; | 
					
						
							|  |  |  | 	}	//	function NOT()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * STATEMENT_IF | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=IF(condition[,returnIfTrue[,returnIfFalse]]) | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 *		Condition is any value or expression that can be evaluated to TRUE or FALSE. | 
					
						
							|  |  |  | 	 *			For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, | 
					
						
							|  |  |  | 	 *			the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. | 
					
						
							|  |  |  | 	 *			This argument can use any comparison calculation operator. | 
					
						
							|  |  |  | 	 *		ReturnIfTrue is the value that is returned if condition evaluates to TRUE. | 
					
						
							|  |  |  | 	 *			For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE, | 
					
						
							|  |  |  | 	 *			then the IF function returns the text "Within budget" | 
					
						
							|  |  |  | 	 *			If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use | 
					
						
							|  |  |  | 	 *			the logical value TRUE for this argument. | 
					
						
							|  |  |  | 	 *			ReturnIfTrue can be another formula. | 
					
						
							|  |  |  | 	 *		ReturnIfFalse is the value that is returned if condition evaluates to FALSE. | 
					
						
							|  |  |  | 	 *			For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE, | 
					
						
							|  |  |  | 	 *			then the IF function returns the text "Over budget". | 
					
						
							|  |  |  | 	 *			If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned. | 
					
						
							|  |  |  | 	 *			If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned. | 
					
						
							|  |  |  | 	 *			ReturnIfFalse can be another formula. | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @param	mixed	$condition		Condition to evaluate | 
					
						
							|  |  |  | 	 * @param	mixed	$returnIfTrue	Value to return when condition is true | 
					
						
							|  |  |  | 	 * @param	mixed	$returnIfFalse	Optional value to return when condition is false | 
					
						
							|  |  |  | 	 * @return	mixed	The value of returnIfTrue or returnIfFalse determined by condition | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 	public static function STATEMENT_IF($condition = TRUE, $returnIfTrue = 0, $returnIfFalse = FALSE) { | 
					
						
							|  |  |  | 		$condition		= (is_null($condition))		? TRUE :	(boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition); | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 		$returnIfTrue	= (is_null($returnIfTrue))	? 0 :		PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue); | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		$returnIfFalse	= (is_null($returnIfFalse))	? FALSE :	PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse); | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-19 22:36:22 +00:00
										 |  |  | 		return ($condition) ? $returnIfTrue : $returnIfFalse; | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	}	//	function STATEMENT_IF()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * IFERROR | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * Excel Function: | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 *		=IFERROR(testValue,errorpart) | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2012-03-11 17:58:38 +00:00
										 |  |  | 	 * @access	public | 
					
						
							|  |  |  | 	 * @category Logical Functions | 
					
						
							|  |  |  | 	 * @param	mixed	$testValue	Value to check, is also the value returned when no error | 
					
						
							|  |  |  | 	 * @param	mixed	$errorpart	Value to return when testValue is an error condition | 
					
						
							|  |  |  | 	 * @return	mixed	The value of errorpart or testValue determined by error condition | 
					
						
							| 
									
										
										
										
											2010-12-02 17:58:26 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	public static function IFERROR($testValue = '', $errorpart = '') { | 
					
						
							|  |  |  | 		$testValue	= (is_null($testValue))	? '' :	PHPExcel_Calculation_Functions::flattenSingleValue($testValue); | 
					
						
							|  |  |  | 		$errorpart	= (is_null($errorpart))	? '' :	PHPExcel_Calculation_Functions::flattenSingleValue($errorpart); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue); | 
					
						
							|  |  |  | 	}	//	function IFERROR()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }	//	class PHPExcel_Calculation_Logical
 |