Bug in the formula MATCH lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- veb86 · 2025-01-17 06:41 See example. The problem is that cell A1 was deleted, never used. In this case, calculation is not possible. This causes a calculation error. Correctly, if a cell is missing, then the MATCH formula should return: #N/A ---------------------------------------------------------------------- wp · 2025-01-17 17:38 I don't understand what "delete" means here: You "delete" the cell content, so that A1 is empty? Or you "delete" the cell itself (or the column) so that the following cells move to the left and the formula must adjusted? Anyway: There is a suspicious code in function fpsMATCH (unit fpsfunc) because the case cell=nil is not handled. Add the following highlighted lines, and report back: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   case Args[0].ResultType of    [...]    rtCell:      begin        cell := ArgToCell(Args[0]);        if cell = nil then        begin          Result := ErrorResult(errWrongType);          exit;        end;      case cell^.ContentType of          cctUTF8String: searchString := cell^.UTF8StringValue;          cctNumber: numSearchValue := cell^.NumberValue;          cctDateTime: numSearchValue := cell^.DateTimeValue;          cctBool: numSearchValue := ord(cell^.BoolValue);          cctEmpty: begin Result := ErrorResult(errWrongType); exit; end;          cctError: begin Result := ErrorResult(errWrongType); exit; end;        end;      end; ---------------------------------------------------------------------- veb86 · 2025-01-18 13:21 Quote from: wp on January 17, 2025, 06:38:31 pmI don't understand what "delete" means here: You "delete" the cell content, so that A1 is empty? Or you "delete" the cell itself (or the column) so that the following cells move to the left and the formula must adjusted? I did the following: 1. Selected the cell whose value the MATH function will search for 2. Pressed the button DELETE Quote from: veb86 on January 17, 2025, 07:41:04 amSee example. The problem is that cell A1 was deleted, never used. In this case, calculation is not possible. This causes a calculation error. Correctly, if a cell is missing, then the MATCH formula should return: #N/A It got better, but not the same Error code returned: #VALUE And it should return #N/A #VALUE is Excel's way of saying, "There's something wrong with the way your formula is typed. Or, there's something wrong with the cells you are referencing." Returns the error value #N/A. #N/A is the error value that means "no value is available." Use NA to mark empty cells. By entering #N/A in cells where you are missing information, you can avoid the problem of unintentionally including empty cells in your calculations. (When a formula refers to a cell containing #N/A, the formula returns the #N/A error value.)