Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Is there a quotient function in VBA that's like Mod

I am trying to do a division but only want the quotient part. I thought there
would be a DIV function that works like MOD function. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Is there a quotient function in VBA that's like Mod

=FLOOR(A1/B1,SIGN(A1)*1)

Or, if you only have positive numbers,

=INT(A1/B1)


--
Kind regards,

Niek Otten

"WannaBeExceller" wrote in
message ...
I am trying to do a division but only want the quotient part. I thought
there
would be a DIV function that works like MOD function. Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Is there a quotient function in VBA that's like Mod

You can use

?INT(val1 / val2)

or

?val1 \ val2

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"WannaBeExceller" wrote in
message ...
I am trying to do a division but only want the quotient part. I thought

there
would be a DIV function that works like MOD function. Thanks in advance.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Is there a quotient function in VBA that's like Mod

Thank you for your response. I found that to work as well as just using the
"\" sign in the division instead of using "/". Thank you once again.

"Niek Otten" wrote:

=FLOOR(A1/B1,SIGN(A1)*1)

Or, if you only have positive numbers,

=INT(A1/B1)


--
Kind regards,

Niek Otten

"WannaBeExceller" wrote in
message ...
I am trying to do a division but only want the quotient part. I thought
there
would be a DIV function that works like MOD function. Thanks in advance.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is there a quotient function in VBA that's like Mod

Dividend ÷ Divisor = Quotient

If you really mean the quotient, then

for a worksheet formula

=6/3

would return 3

in VBA

res = 6/3
res would contain 2

dim res as double
res = 5/3
res would contain 1.66666666666667 or there abouts.

from the immediate window:
res#=5/3
? res
1.66666666666667

--
Regards,
Tom Ogilvy

"WannaBeExceller" wrote in
message ...
I am trying to do a division but only want the quotient part. I thought

there
would be a DIV function that works like MOD function. Thanks in advance.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is there a quotient function in VBA that's like Mod

Just to ADD:

http://mathworld.wolfram.com/Quotient.html

My answer interpreted Quotient with the most common interpretation. If you
want the whole number portion of a division

i.e, If you want the Integer portion of the Quotient <g, then look in Excel
VBA help at TRUNC and INT

in VBA, use integer division ( \ )

? 6\4
1
? -6\4
-1

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Dividend ÷ Divisor = Quotient

If you really mean the quotient, then

for a worksheet formula

=6/3

would return 3

in VBA

res = 6/3
res would contain 2

dim res as double
res = 5/3
res would contain 1.66666666666667 or there abouts.

from the immediate window:
res#=5/3
? res
1.66666666666667

--
Regards,
Tom Ogilvy

"WannaBeExceller" wrote in
message ...
I am trying to do a division but only want the quotient part. I thought

there
would be a DIV function that works like MOD function. Thanks in advance.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i round a quotient to specific decimal places? gissineth Excel Worksheet Functions 3 March 4th 10 03:18 AM
Why QUOTIENT function is not being recognized? math function[_2_] Excel Worksheet Functions 3 July 17th 08 03:17 AM
quotient function prob. i have copied example but it gives error Chris Whitehead Excel Discussion (Misc queries) 10 March 28th 07 12:06 AM
Make divisions and display no decimal value at the quotient! FreakyShadow Excel Discussion (Misc queries) 2 March 5th 06 05:28 AM
How do I set a mimimum quotient value? Robert Excel Worksheet Functions 4 January 19th 05 07:50 PM


All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"