Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Mod(number;divisor)


I would like to get the remainder in a script.

In an excel sheet, I use to write remainder = Mod(number;divisor)

but that function doesn't work with a VBA script.

I tried number%divisor (like I would do in C++) but it didn't work.

What should I do ?

Frank


--
Mhek
------------------------------------------------------------------------
Mhek's Profile: http://www.excelforum.com/member.php...o&userid=33427
View this thread: http://www.excelforum.com/showthread...hreadid=534122

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Mod(number;divisor)

rem = number MOD divisor

e.g

rem = 51 MOD 6

HTH

"Mhek" wrote:


I would like to get the remainder in a script.

In an excel sheet, I use to write remainder = Mod(number;divisor)

but that function doesn't work with a VBA script.

I tried number%divisor (like I would do in C++) but it didn't work.

What should I do ?

Frank


--
Mhek
------------------------------------------------------------------------
Mhek's Profile: http://www.excelforum.com/member.php...o&userid=33427
View this thread: http://www.excelforum.com/showthread...hreadid=534122


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Mod(number;divisor)

Mod is an operator in VBA

remainder = 23 mod 10
? remainder
3

Note that the behavior is somewhat different from the Excel function for
non integers. See help.

--
Regards,
Tom Ogilvy




?
"Mhek" wrote:


I would like to get the remainder in a script.

In an excel sheet, I use to write remainder = Mod(number;divisor)

but that function doesn't work with a VBA script.

I tried number%divisor (like I would do in C++) but it didn't work.

What should I do ?

Frank


--
Mhek
------------------------------------------------------------------------
Mhek's Profile: http://www.excelforum.com/member.php...o&userid=33427
View this thread: http://www.excelforum.com/showthread...hreadid=534122


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
Sumif number is greater than a number but less than another number lulu151 Excel Discussion (Misc queries) 2 May 7th 10 07:12 PM
How do I keep the divisor constant in calculating percentage remai clpayne Excel Discussion (Misc queries) 3 June 29th 09 10:30 PM
How to calculate number of occurencies of a specific number number Stefan Excel Discussion (Misc queries) 4 September 8th 08 08:33 AM
Change divisor if column is 0 Carol Mac[_2_] Excel Discussion (Misc queries) 12 May 31st 07 05:53 PM
Rounding a number to a multiple quantity that adds to a fixed total number wjlo Excel Worksheet Functions 1 November 9th 04 04:43 PM


All times are GMT +1. The time now is 03:45 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"