LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default WorksheetFunction.Round using user-selectable rounding value?

I don't think that you and Bob are talking about the same thing. When you
say "sample figure", is sounds like you are talking about
Sheets("Output").Cells(45,
2).Value, where Bob appears to be talking about your variable named
RoundingValue.

The worksheet function ROUND() takes two arguments, number and num_digits.
Whenever ABS(number)<(10^-TRUNC(num_digits))/2, then then the result will be
zero, since number is closer to 0 than the smallest possible non-zero rounded
value. When num_digits<0, then that break point is 1, which may have snuck
up on you.

Jerry

"Punsterr" wrote:

Bob,

Nice catch! The sample figure I was testing it on just happened to be a
negative number. The macro does work for positive numbers. However,
I'm still not sure I'm following why the 0 value would come up for a
negative number. If I was just doing that same rounding function in an
Excel formula, it would round the negative number to the nearest
hundred/thousand/million. Any thoughts on what I need to change in my
macro to round both positive and negative numbers in the same
programming loop? (The Output sheet will have 15+ values that will be
rounded, some of which will be positive and some of which will be
negative.)


 
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
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH SunshineinFt.Myers[_2_] Excel Worksheet Functions 7 March 5th 09 06:41 PM
User Selectable Series and Number of Series for Line Chart Dave in NJ Charts and Charting in Excel 2 February 23rd 09 12:18 AM
Formula help - rounding up and round down? 0greeny0 Excel Worksheet Functions 2 February 21st 09 12:10 PM
Help please- user selectable image Regnar Excel Programming 1 April 21st 04 06:09 PM
WorkSheetFunction.CountIf & WorkSheetFunction.SumIf with 2 conditions? Etien[_2_] Excel Programming 3 January 13th 04 04:07 PM


All times are GMT +1. The time now is 11:49 PM.

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

About Us

"It's about Microsoft Excel"