Excel SQR Function
The Excel SQR function returns the square root of a number.
The SQR function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a VBA function in Excel. As a VBA function, this function can be used in a Excel macro code. The Excel macro code can be created using the Microsoft Visual Basic Editor.
Syntax
SQR(number)
Parameters
number |
Required. Specify a positive value to get the square root of. |
Return Value
Returns the square root of a value.
Notes
- If the argument is a negative number, SQR function will raise an error.
Example: Using as VBA Function
The SQR function can be used in VBA code in Microsoft Excel. Consider the example below:
Dim FValue As Double FValue = SQR(3)
In this example, the variable called FValue will contain the value of 1.73205080756888.
Similarly, for the different input the VBA code will give the following output:
SQR(2) Result: 1.414213562 SQR(4) Result: 2 SQR(8) Result: 2.828427125 SQR(16) Result: 4 SQR(100) Result: 100
❮ Excel Functions