Adding IF() to the math.php library

Hi. I’ve been working on a project with the dhtmlx spreadsheet, and would like to allow users to use IF() (and more specifically, COUNTIF() and SUMIF()) within the spreadsheet. We have already added a number of functions to the library (such as a standard distribution function), but are encountering problems when trying to create functions that accept non-numerical inputs (in this case, boolean operators (==, !=, >, >=, <, <=)). If anyone has created functions for the dhtmlx spreadsheet that accept non-numerical arguments, or has any advice on creating them, it would be very helpful to know. Thank you.