To return an absolute value of a number in Excel requires the use of the ABS Function. An absolute value of a number is a the number without its sign, for example a + or –.
The correct syntax for the ABS Function is simple and shown below:
Where (number) represents the actual number you want an absolute value for. This could be the number itself or the reference of a cell containing your actual number. For example:
So let’s assume cell A1 has -2 written in it. You could get the absolute value of this in another cell with two different methods…
Both the above formula would result in a 2 being returned.
The ABS function can also be used in VBA. So let’s assume you have declared (dimmed) a variable for your number and called it
Then to give the variable its value you would use ABS first. So
Nice short post. Hope you find it useful!