How to use the FIX function [VBA]
The FIX function removes the decimals from the argument.
Excel Function VBA Syntax
Fix(number)
Arguments
number | Required. Is a Double or any valid numeric expression. If number is 0 (zero) then 0 (zero) is returned. |
Comments
I used the following macro to show how the Fix function behaves with different arguments.
Sub Macro1() For Each cell In Range("B3:B12") cell.Offset(, 1) = Fix(cell.Value) Next cell End Sub
Formula equation
Fix(number) = Sgn(number) * Int(Abs(number))
How to use the INT function [VBA]
The INT function removes the decimals if the numeric value is above 0 (zero) and returns a negative integer less than […]
How to use the SGN function [VBA]
The SGN function returns an integer that shows the sign of the number. Argument SGN returns Number greater than 0 (zero). […]
How to use the JOIN function [VBA]
The JOIN function concatenates a set of substrings in an array, the image shows a user-defined function entered in cell […]
How to use the LBOUND and UBOUND functions
The Lbound and Ubound functions calculate the size of of an array. The Lbound returns the lower limit of an array and […]
2 Responses to “How to use the FIX function [VBA]”
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
In Office 365 it is a function named FIXED who do same things.
No. That is no true
If first digit of decimals are >= 5, rezult of FIXED is number + 1
24.5 -> =FIXED(24.5,0,0)=25
-148.69 -> =FIXED(-148.69,0,0)=-149