LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel.newusers
Dana DeLouis
 
Posts: n/a
Default find sum in list of of numbers


Hi Harlan. I love your "FindSum" program. It's excellent! Just for
feedback, in a permutation timing program that I have, I was coming up 1
number larger in the total number of solutions. Tracing the program back,
it appears to me that if the list is sorted, then the program misses the sum
of the first 'n' items. For example, if the op's data were sorted, then it
would miss finding the sum of the first two items (207.70+240.16 = 447.86)

A more simplier test might be with the number sequence 1,2,3...10. A
search for 3 might miss 1+2, or a search of 6 might miss 1+2+3.
Again, only if the data is sorted. I'm not sure at this point where in the
program to make a recommendation. Excellent code though. :)

--
Dana DeLouis
Win XP & Office 2003


"Harlan Grove" wrote in message
oups.com...
Jim Thomlinson wrote...
...
Private Sub PostAnswers(ByVal strValue As String, ByVal rng As Range)
Dim aryCSVValues As Variant
Dim intCounter As Integer

aryCSVValues = Split(Mid$(strValue, 2, Len(strValue)), "+")
For intCounter = LBound(aryCSVValues) To UBound(aryCSVValues)
rng.Value = aryCSVValues(intCounter)
Set rng = rng.Offset(0, 1)
Next intCounter
End Sub

...

This is your code. You should have indicated that. You also made a few
modifications in my original procedures. I don't have an issue with you
modifying my code, just with the lack of any way to distinguish your
code from mine.

Off-topic: I hate long variable names. There's a problematic case for
them in long, complex procedures, but other than typing exercise I
don't see the usefulness in short procedures. Ah, for programmers'
editors in which different colors could be assigned to variable tokens
of different types!

Back on-topic. My own code is at

http://groups.google.com/group/micro...19858047398beb

Your comment in your other response in this thread is apt: N 30 makes
for LONG execution times, but the macro works for larger N. I haven't
torture-tested it, but the large N with skewed values (median value
outside mean +/- 25%) will almost certainly exceed most PC's memory
resources, real and virtual. I have a test case with N=100 cells filled
with values generated by =ROUND(RAND()^-4,2), in the particular case 68
of 100 values < 100, and sought 5000 as the sum. There were 129
combinations of 1 to 6 values summing to 5000 and 464 of 7 (when I
cancelled the macro). Not sure how much information there might be if
there were more than 1 million combinations summing to 5000. How would
anyone choose which one to use?

In other words, the programming was an interesting exercise, but I
still don't believe it provides any value.



 
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
find sum in list of of numbers Jim Thomlinson Excel Discussion (Misc queries) 5 January 4th 06 07:07 PM
find next number in list zero Excel Discussion (Misc queries) 3 September 27th 05 10:21 PM
Find in a list Dkso Excel Discussion (Misc queries) 8 September 7th 05 02:57 PM
Find the combination of numbers that when added equal a reqired total?? Handsy11 Excel Worksheet Functions 5 July 12th 05 04:55 PM
How do I filter a number list by numbers to the right of the decim louannes Excel Worksheet Functions 2 July 7th 05 05:11 AM


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

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"