Boolean / If evaluation time relative to other functions

Amateurhr

Active Member
Joined
Dec 26, 2011
Messages
343
This is more a general programming question but often I try to abstract the capabilities of a function by allowing it to take optional parameters that give the function flexibility in how you feed it incoming data.

In order for this to work, I often will be doing evaluations of the parameters, and in particular booleans. Often I'm tempted to create separate functions that will avoid a boolean evaluation for speed purposes, but I realize this might be an unnecessary if booleans are evaluated an order of magnitude faster than other functions.

Consider:
Code:
If varBoolean then 
'do something
else
'do something
end if

Any thoughts on how fast this is to evaluate vs. other excel functions?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
It really depends on how your boolean value is used.
If it's something that can be avoided, you should not use it (which is the best way to reduce resources)

If you want comparison in speed for IF against all the other comparison methods, I would suggest using anything that is easier to read.
Each case is different for comparison so you can safely say all the other methods are the same in terms of speed.

The only thing I would suggest would be using Byte for comparison rather than Boolean as Byte takes up one byte while Boolean takes up two bytes in VBA (which is... odd).
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,705
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top