Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel.newusers
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find sum in list of of numbers | Excel Discussion (Misc queries) | |||
find next number in list | Excel Discussion (Misc queries) | |||
Find in a list | Excel Discussion (Misc queries) | |||
Find the combination of numbers that when added equal a reqired total?? | Excel Worksheet Functions | |||
How do I filter a number list by numbers to the right of the decim | Excel Worksheet Functions |