In an Excel sheet, how can I validate a column to accept only numbers and reject dates? (ISNUMBER is not working)

54 Views Asked by At

I have a column named 'quantity' where the user should only input a number

sheet.range(`D2:D${allItems.length + 1}`).dataValidation({
        type: 'whole',
        operator: 'greaterThan',
        formula1: '0',
        showErrorMessage: true,
        errorTitle: 'Invalid Quantity',
        error: 'Please enter a valid quantity.',
        errorStyle: 'stop',
        errorAlert: 'warning',
      });

This function works correctly, but during testing, when I input '1-2', it converts it into a date and accepts it, which is a significant issue. I attempted to use ISNUMBER(), but it didn't work.

Note. The ISNUMBER function allows any numeric values in validated cells, including integers, decimals, fractions as well as dates and times, which are also numbers in terms of Excel.

0

There are 0 best solutions below