Google Scripts Returning Not a Number

前端 未结 1 2011
猫巷女王i
猫巷女王i 2021-01-25 16:11

I\'ve been working on Google Scripts for a bit, but I can\'t seem to find the solution to my problem. What I am trying to do is multiply the contents of two cells on a spreadshe

相关标签:
1条回答
  • 2021-01-25 17:03

    This error occurs when you try to perform calculations with values that are not all numbers, example a Number and a String.

    Google Sheets stores data depending on the value of the cell, the values may be of type Number, Boolean, Date, or String (Empty cells will return an empty String). When these values are used by Custom Functions, Apps Script treats them as the appropriate data type in JavaScript.

    You need to make sure the values of the cells are Numbers, take into account that if the cell contains some space or other non-numeric characters like "2 2" or "3/2" it will be treated as String and you will need to trim or extract those special characters before any calculation.

    0 讨论(0)
提交回复
热议问题