New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

The Forgotten Operand (VBA)

Free Excel Tips and Tutorials

The Forgotten Operand (VBA)

Postby Sisyphus » Mon Mar 05, 2012 8:08 pm

VBA has the same four operands as Excel:-
+ for additions
- for subtractions
* for multiplications and
/ for divisions
but VBA has a fifth operand that you rarely see in published code:-
\ for division with integer result.

Such,
Code: Select all
10/3 = 3.3333333
10\3 = 3
INT(10/3) = 3

Using the backslash operand is faster than the INT() function for the simple reason that it carries out a single calculation where the function has two.

Unfortunatley, the fifth operand isn't available in Excel. So, you can't enjoy its ease and simplicity in a worksheet.
Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010

Return to Excel Tips and Tutorials

Who is online

Users browsing this forum: No registered users and 24 guests

cron