LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Sum part of range passed to UDF

I am passing a range, along with some other parameters, to a UDF that
calculates a safety stock requirement.

Based on the other parameters I send to the UDF, the UDF needs to
return the sum of a certain number of sequential elements in the
range. For example, if the range contains (2, 2, 2, 3, 3, 3, 4, 4, 4),
and I need 4 weeks of safety stock, the UDF should sum 2 + 2 + 2 + 3.

Would there be a way to sum with a single command the first four
values the above range? Currently I am looping through the range and
adding the "next" value on each loop through the range. However, I am
hitting some performance issues (this UDF is several hundred times in
the workbook) and am looking for a faster method.
 
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
Modify range variable passed through Function spyd3r Excel Programming 8 February 14th 06 11:22 PM
ClearContents method on a passed range bryan New Users to Excel 2 January 19th 05 08:49 AM
PrintOut macro from ?passed range.addrsess Jabba Excel Programming 1 November 2nd 04 01:53 AM
segregating passed range by rows and columns Michael Malinsky[_3_] Excel Programming 1 September 15th 04 05:30 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk[_25_] Excel Programming 3 September 7th 04 12:47 PM


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