Math, JavaScript Programming Example of Math in SpreadSheet

JavaScript Programming Example of Math in SpreadSheet

You can effortlessly enable math calculations in SpreadSheet. Check out a coding sample below showing how to do it. You can download and use this programming example for free.

JS Code

webix.ready(function(){
  webix.ui({
    id: "ssheet",
    view:"spreadsheet",
    data: all_math_data
  });
});

HTML Code

<script>
  var all_math_data = {
  "conditions": [],
  "styles": [
    [
      "wss1",
      ";;;;;;;;;;;date;;;;"
    ],
    [
      "wss2",
      ";;;;;;;;;;;fmt0;;;;"
    ],
    [
      "wss3",
      ";;;;;;;bold;;;;;;;;"
    ],
    [
      "wss4",
      ";#00ffff;;;;;;bold;;;;;;;;"
    ],
    [
      "wss5",
      "#ffffff;#00ffff;;;;;;bold;;;;;;;;"
    ],
    [
      "wss6",
      "#ffffff;#ff0000;;;;;;bold;;;;;;;;"
    ],
    [
      "wss7",
      "#ffffff;#0000ff;;;;;;bold;;;;;;;;"
    ],
    [
      "wss8",
      ";#0000ff;;;;;;;;;;;;;;"
    ],
    [
      "wss9",
      "#ffffff;#0000ff;;;;;;;;;;;;;;"
    ],
    [
      "wss10",
      "#0000ff;;;;;;;;;;;;;;;"
    ],
    [
      "wss11",
      "#ffffff;;;;;;;;;;;;;;;"
    ]
  ],
  "formats": [
    [
      "fmt0",
      "hh:mm AM/PM"
    ]
  ],
  "spans": [],
  "sizes": [
    [
      0,
      4,
      102
    ],
    [
      0,
      5,
      102
    ],
    [
      0,
      8,
      120
    ],
    [
      0,
      9,
      78
    ],
    [
      0,
      12,
      125
    ],
    [
      0,
      16,
      102
    ]
  ],
  "table": {
    "frozenColumns": 0,
    "frozenRows": 0,
    "gridlines": 1,
    "headers": 1
  },
  "data": [
    [
      1,
      1,
      0,
      "",
      "number"
    ],
    [
      1,
      3,
      "DATES",
      "wss7",
      "string"
    ],
    [
      1,
      4,
      "DATE",
      "",
      "string"
    ],
    [
      1,
      5,
      "=DATE(A1,A2,A3)",
      "wss1",
      "date"
    ],
    [
      1,
      7,
      "NUMBERS",
      "wss9",
      "string"
    ],
    [
      1,
      8,
      "SUM",
      "",
      "string"
    ],
    [
      1,
      9,
      "=SUM(A1:A5)",
      "",
      "number"
    ],
    [
      1,
      11,
      "STRINGS",
      "wss9",
      "string"
    ],
    [
      1,
      12,
      "CONCATENATE",
      "",
      "string"
    ],
    [
      1,
      13,
      "=CONCATENATE(A2,A3)",
      "",
      "number"
    ],
    [
      1,
      15,
      "OTHERS",
      "wss9",
      "string"
    ],
    [
      1,
      16,
      "IF",
      "",
      "string"
    ],
    [
      1,
      17,
      "=IF(E37,M3,M5)",
      "",
      "number"
    ],
    [
      2,
      1,
      1,
      "",
      "number"
    ],
    [
      2,
      4,
      "TIME",
      "",
      "string"
    ],
    [
      2,
      5,
      "=TIME(A1,A2,A3)",
      "wss2",
      "date"
    ],
    [
      2,
      8,
      "AVERAGE",
      "",
      "string"
    ],
    [
      2,
      9,
      "=AVERAGE(A1:A5)",
      "",
      "number"
    ],
    [
      2,
      12,
      "LEFT",
      "",
      "string"
    ],
    [
      2,
      13,
      "=LEFT(M1,1)",
      "",
      "number"
    ],
    [
      2,
      16,
      "SPARKLINE",
      "",
      "string"
    ],
    [
      2,
      17,
      "=SPARKLINE(A1:A5,\"line\",\"#6666FF\")",
      "",
      "string"
    ],
    [
      3,
      1,
      2,
      "",
      "number"
    ],
    [
      3,
      4,
      "DAY",
      "",
      "string"
    ],
    [
      3,
      5,
      "=DAY(E1)",
      "",
      "number"
    ],
    [
      3,
      8,
      "COUNT",
      "",
      "string"
    ],
    [
      3,
      9,
      "=COUNT(A1:A7)",
      "",
      "number"
    ],
    [
      3,
      12,
      "MID",
      "",
      "string"
    ],
    [
      3,
      13,
      "=MID(L1,A4,A4)",
      "",
      "number"
    ],
    [
      3,
      16,
      "IMAGE",
      "",
      "string"
    ],
    [
      3,
      17,
      "=IMAGE(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAbCAMAAAByZu6xAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAFdQTFRFmdnqAAAAXjkmYj0qbkk2cU06AAAA/3mmra2tcU05////NrxgNbxgkJCQ7y84VFRULi4uLS0tj4+PiYmJTk5OQkJCbUk2YTwpSEhIhYWFgYGBf39/QEBAq14fJwAAAB10Uk5T/wD////////////////////////////////////nQ6jsAAAAgElEQVR4nI3OaxeCIAwG4C31jTRaYNoF/v/vbAMLP7rD5Tk724CIf0F7/k0nPs6usW8c9gT01sN4BnQXOgvlhTFObpwar5Xe3Zwv1G7YFMsK7ijDIB4BiDMNEjUteECzHCQKFtDKHCJmq30yv96fhPr1DEauTMlWoabyVqAt9toXKJ4FsGUNdyYAAAAASUVORK5CYII=\")",
      "",
      "string"
    ],
    [
      4,
      1,
      3,
      "",
      "number"
    ],
    [
      4,
      4,
      "MONTH",
      "",
      "string"
    ],
    [
      4,
      5,
      "=MONTH(E1)",
      "",
      "number"
    ],
    [
      4,
      8,
      "COUNTA",
      "",
      "string"
    ],
    [
      4,
      9,
      "=COUNTA(A1:A7)",
      "",
      "number"
    ],
    [
      4,
      12,
      "RIGHT",
      "",
      "string"
    ],
    [
      4,
      13,
      "=RIGHT(M3,A3)",
      "",
      "number"
    ],
    [
      4,
      16,
      "HYPERLINK",
      "",
      "string"
    ],
    [
      4,
      17,
      "=HYPERLINK(\"https://webix.com/\",\"WEBIX\")",
      "",
      "number"
    ],
    [
      5,
      1,
      4,
      "",
      "number"
    ],
    [
      5,
      4,
      "YEAR",
      "",
      "string"
    ],
    [
      5,
      5,
      "=YEAR(E1)",
      "",
      "number"
    ],
    [
      5,
      8,
      "COUNTBLANK",
      "",
      "string"
    ],
    [
      5,
      9,
      "=COUNTBLANK(A1:A7)",
      "",
      "number"
    ],
    [
      5,
      12,
      "LOWER",
      "",
      "string"
    ],
    [
      5,
      13,
      "=LOWER(M3)",
      "",
      "number"
    ],
    [
      6,
      1,
      5,
      "",
      "number"
    ],
    [
      6,
      4,
      "HOUR",
      "",
      "string"
    ],
    [
      6,
      5,
      "=HOUR(E2)",
      "",
      "number"
    ],
    [
      6,
      8,
      "MAX",
      "",
      "string"
    ],
    [
      6,
      9,
      "=MAX(A1:A6)",
      "",
      "number"
    ],
    [
      6,
      12,
      "UPPER",
      "",
      "string"
    ],
    [
      6,
      13,
      "=UPPER(M5)",
      "",
      "number"
    ],
    [
      7,
      4,
      "MINUTE",
      "",
      "string"
    ],
    [
      7,
      5,
      "=MINUTE(E2)",
      "",
      "number"
    ],
    [
      7,
      8,
      "MIN",
      "",
      "string"
    ],
    [
      7,
      9,
      "=MIN(A1:A6)",
      "",
      "number"
    ],
    [
      7,
      12,
      "PROPER",
      "",
      "string"
    ],
    [
      7,
      13,
      "=PROPER(CONCATENATE(M3, \" \", M5))",
      "",
      "number"
    ],
    [
      8,
      4,
      "SECOND",
      "",
      "string"
    ],
    [
      8,
      5,
      "=SECOND(E2)",
      "",
      "number"
    ],
    [
      8,
      8,
      "PRODUCT",
      "",
      "string"
    ],
    [
      8,
      9,
      "=PRODUCT(A2:A6)",
      "",
      "number"
    ],
    [
      8,
      12,
      "TRIM",
      "",
      "string"
    ],
    [
      8,
      13,
      "=TRIM(\"     \"&M7&\"   \")",
      "",
      "number"
    ],
    [
      9,
      4,
      "NOW",
      "",
      "string"
    ],
    [
      9,
      5,
      "=NOW()",
      "wss1",
      "date"
    ],
    [
      9,
      8,
      "SUMPRODUCT",
      "",
      "string"
    ],
    [
      9,
      9,
      "=SUMPRODUCT(A1:A6)",
      "",
      "number"
    ],
    [
      9,
      12,
      "LEN",
      "",
      "string"
    ],
    [
      9,
      13,
      "=LEN(M7)",
      "",
      "number"
    ],
    [
      10,
      4,
      "DATEDIF",
      "",
      "string"
    ],
    [
      10,
      5,
      "=DATEDIF(E9,E1,\"M\")",
      "",
      "number"
    ],
    [
      10,
      8,
      "SUMSQ",
      "",
      "string"
    ],
    [
      10,
      9,
      "=SUMSQ(A1:A6)",
      "",
      "number"
    ],
    [
      11,
      8,
      "VARP",
      "",
      "string"
    ],
    [
      11,
      9,
      "=VARP(A1:A6)",
      "",
      "number"
    ],
    [
      12,
      8,
      "STDEVP",
      "",
      "string"
    ],
    [
      12,
      9,
      "=STDEVP(A2:A6)",
      "",
      "number"
    ],
    [
      13,
      8,
      "POWER",
      "",
      "string"
    ],
    [
      13,
      9,
      "=POWER(A3,A4)",
      "",
      "number"
    ],
    [
      14,
      8,
      "QUONTIENT",
      "",
      "string"
    ],
    [
      14,
      9,
      "=QUOTIENT(A5,A3)",
      "",
      "number"
    ],
    [
      15,
      8,
      "SQRT",
      "",
      "string"
    ],
    [
      15,
      9,
      "=SQRT(A5)",
      "",
      "number"
    ],
    [
      16,
      8,
      "ABS",
      "",
      "string"
    ],
    [
      16,
      9,
      "=ABS(A6*-1)",
      "",
      "number"
    ],
    [
      17,
      8,
      "RAND",
      "",
      "string"
    ],
    [
      17,
      9,
      "=RAND()",
      "",
      "number"
    ],
    [
      18,
      8,
      "PI",
      "",
      "string"
    ],
    [
      18,
      9,
      "=PI()",
      "",
      "number"
    ],
    [
      19,
      8,
      "INT",
      "",
      "string"
    ],
    [
      19,
      9,
      "=INT(A4/A5)",
      "",
      "number"
    ],
    [
      20,
      8,
      "ROUND",
      "",
      "string"
    ],
    [
      20,
      9,
      "=ROUND(A4/A5,A2)",
      "",
      "number"
    ],
    [
      21,
      8,
      "ROUNDDOWN",
      "",
      "string"
    ],
    [
      21,
      9,
      "=ROUNDDOWN(A4/A5,A2)",
      "",
      "number"
    ],
    [
      22,
      8,
      "ROUNDUP",
      "",
      "string"
    ],
    [
      22,
      9,
      "=ROUNDUP(A4/A5,A2)",
      "",
      "number"
    ],
    [
      23,
      8,
      "TRUNC",
      "",
      "string"
    ],
    [
      23,
      9,
      "=TRUNC(A4/A5)",
      "",
      "number"
    ],
    [
      24,
      8,
      "EVEN",
      "",
      "string"
    ],
    [
      24,
      9,
      "=EVEN(A2)",
      "",
      "number"
    ],
    [
      25,
      8,
      "ODD",
      "",
      "string"
    ],
    [
      25,
      9,
      "=ODD(A5)",
      "",
      "number"
    ]
  ],
  "ranges": [],
  "locked": [],
  "editors": [],
  "filters": [],
  "comments": [],
  "views": []
}
</script>

Would you like to use a spreadsheet with advanced Excel-like features?