PI function
PRO
BASIC
The PI function in Jspreadsheet Formulas Pro is used to return the mathematical constant pi, which is accurate to 15 digits. When you use this function, it will automatically generate the value of pi (approximately 3.141592653589793). This is especially useful in calculations involving circles or any other mathematical formulas where pi is needed. No arguments are needed for this function, just type =PI()
and it will give you the value.
Documentation
Returns the mathematical constant pi, accurate to 15 digits.
Category
Math and trigonometry
Syntax
PI()
Parameter | Description |
---|
Behavior
The PI
function doesn't take any arguments and it always returns the value of pi, which is approximately 3.141592653589793. This function doesn't interact with cells, so it doesn't handle empty cells, text, booleans, errors, or any other types of cell content.
Common Errors
Error | Description |
---|---|
#VALUE! | Occurs if any arguments are provided to the PI function, as it does not take any arguments. |
Best practices
- The
PI
function does not take any arguments, so make sure not to include any.- Remember that the value returned by
PI
is an approximation, and it may not be precise enough for some scientific or mathematical calculations.- If you need to use the value of pi in several places in your spreadsheet, consider using the
PI
function instead of typing out the value manually. This ensures consistency and reduces the risk of errors.- If you need to use the value of pi a lot, you might want to store the result of the
PI
function in a cell and then reference that cell in your calculations. This can make your formulas easier to read and understand.
Usage
A few examples using the PI function.
PI() returns 3.141592653589793, which is the mathematical constant pi accurate to 15 digits
2*PI()*A1 returns the circumference of a circle when the radius is stored in column A1
Interactive Spreadsheet Demo
<html>
<script src="https://jspreadsheet.com/v11/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://jspreadsheet.com/v11/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
<script src="https://cdn.jsdelivr.net/npm/@jspreadsheet/formula-pro/dist/index.min.js"></script>
<div id="spreadsheet"></div>
<script>
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('NWEzN2E2NmUzMTRmZDYyMmY5Y2I1NmYzNWQ2ZjI1ZTk2NWU2ZTVhNmFkOTA5MGQ2NjgzYTViZmQ0OWI3OTI2YWRmOWUwZDgxYjE1ODMxZjBhOTQ1ZjcwMzc2NGZhNGUxZDBlMmUxZDE0YWFjNjFjNGRhZDkzMjIyNjUzOTUxZWUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVMk56a3pNRGMwTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');
// Set the extensions
jspreadsheet.setExtensions({ formula });
// Create a new spreadsheet
jspreadsheet(document.getElementById('spreadsheet'), {
worksheets: [{
data: [
[
"Radius",
"Circumference",
"Area"
],
[
3,
"=2*PI()*A2",
"=PI()*A2^2"
],
[
5,
"=2*PI()*A3",
"=PI()*A3^2"
],
[
7.5,
"=2*PI()*A4",
"=PI()*A4^2"
]
]
}]
});
</script>
</html>
import React, { useRef } from "react";
import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react";
import formula from "@jspreadsheet/formula-pro";
import "jsuites/dist/jsuites.css";
import "jspreadsheet/dist/jspreadsheet.css";
// Set license
jspreadsheet.setLicense('NWEzN2E2NmUzMTRmZDYyMmY5Y2I1NmYzNWQ2ZjI1ZTk2NWU2ZTVhNmFkOTA5MGQ2NjgzYTViZmQ0OWI3OTI2YWRmOWUwZDgxYjE1ODMxZjBhOTQ1ZjcwMzc2NGZhNGUxZDBlMmUxZDE0YWFjNjFjNGRhZDkzMjIyNjUzOTUxZWUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVMk56a3pNRGMwTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');
// Set the extensions
jspreadsheet.setExtensions({ formula });
export default function App() {
// Spreadsheet array of worksheets
const spreadsheet = useRef();
// Worksheet data
const data = [
[
"Radius",
"Circumference",
"Area"
],
[
3,
"=2*PI()*A2",
"=PI()*A2^2"
],
[
5,
"=2*PI()*A3",
"=PI()*A3^2"
],
[
7.5,
"=2*PI()*A4",
"=PI()*A4^2"
]
];
// Render component
return (
<Spreadsheet ref={spreadsheet}>
<Worksheet data={data} />
</Spreadsheet>
);
}
<template>
<Spreadsheet ref="spreadsheet">
<Worksheet :data="data" />
</Spreadsheet>
</template>
<script>
import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/vue";
import "jsuites/dist/jsuites.css";
import "jspreadsheet/dist/jspreadsheet.css";
import formula from "@jspreadsheet/formula-pro";
// Set license
jspreadsheet.setLicense('NWEzN2E2NmUzMTRmZDYyMmY5Y2I1NmYzNWQ2ZjI1ZTk2NWU2ZTVhNmFkOTA5MGQ2NjgzYTViZmQ0OWI3OTI2YWRmOWUwZDgxYjE1ODMxZjBhOTQ1ZjcwMzc2NGZhNGUxZDBlMmUxZDE0YWFjNjFjNGRhZDkzMjIyNjUzOTUxZWUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVMk56a3pNRGMwTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');
// Set the extensions
jspreadsheet.setExtensions({ formula });
export default {
components: {
Spreadsheet,
Worksheet,
},
data() {
// Worksheet data
const data = [
[
"Radius",
"Circumference",
"Area"
],
[
3,
"=2*PI()*A2",
"=PI()*A2^2"
],
[
5,
"=2*PI()*A3",
"=PI()*A3^2"
],
[
7.5,
"=2*PI()*A4",
"=PI()*A4^2"
]
]
return {
data
};
}
}
</script>
import { Component, ViewChild, ElementRef } from "@angular/core";
import jspreadsheet from "jspreadsheet";
import * as formula from "@jspreadsheet/formula-pro";
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('NWEzN2E2NmUzMTRmZDYyMmY5Y2I1NmYzNWQ2ZjI1ZTk2NWU2ZTVhNmFkOTA5MGQ2NjgzYTViZmQ0OWI3OTI2YWRmOWUwZDgxYjE1ODMxZjBhOTQ1ZjcwMzc2NGZhNGUxZDBlMmUxZDE0YWFjNjFjNGRhZDkzMjIyNjUzOTUxZWUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVMk56a3pNRGMwTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');
// Set the extensions
jspreadsheet.setExtensions({ formula });
@Component({
standalone: true,
selector: "app-root",
template: `<div #spreadsheet></div>`
})
export class AppComponent {
@ViewChild("spreadsheet") spreadsheet: ElementRef;
// Worksheets
worksheets: jspreadsheet.worksheetInstance[];
// Create a new data grid
ngAfterViewInit() {
// Create spreadsheet
this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, {
worksheets: [{
data: [
[
"Radius",
"Circumference",
"Area"
],
[
3,
"=2*PI()*A2",
"=PI()*A2^2"
],
[
5,
"=2*PI()*A3",
"=PI()*A3^2"
],
[
7.5,
"=2*PI()*A4",
"=PI()*A4^2"
]
]
}]
});
}
}