Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have this excel file (represents the MM1 queue simulation)

i have a hard time figuring out what's wrong because each part works well on its own i've marked the places that are wrong
i'm working with floats ,and done 3/4 of the program correctly except for few parts

these excel functions that i'm having problems with
i created a function to return max of 2 floats and another to count the cells in an array that are more than a certain value
but the result is not right it isn't changing always 0 1 1 after 1 1 2
function in excel =MAX(J5-(COUNTIF($I$5:$I$34,">="&C5) - COUNTIF($I$5:$I$34,">="&C6)),0)
# in QueueBefore=bfinq

function in excel =IF(((COUNTIF($I$5:$I$34,">="&C5) - COUNTIF($I$5:$I$34,">="&C6))=L5), 0,1)
# in ServerBefore=bfins

depends on the top 2 so it isn't working
# in QueueAfter =afinq
Posted
Updated 16-Dec-14 3:48am
v5
Comments
CPallini 16-Dec-14 6:49am    
I see out of array bounds in your code. By the why, you should post the code here.
Duaa07 16-Dec-14 9:48am    
Thnaks!
Duaa07 16-Dec-14 6:52am    
umm although all the arrays are of size 34 i though something is wrong with using floats .
okay i'll
Jochen Arndt 16-Dec-14 8:46am    
As already noted by CPallini, you access array items out of bounds.

With array sizes of 34 items, the allowed indices are 0 to 33.
You are not only using loops generating indices of 34 but also access items inside the loops using the index plus one resulting in indices of 35!.

As a result you are passing undefined values to your max() and count() functions.
Duaa07 16-Dec-14 9:47am    
Thank you so much!
i fixed that and it is working now :)!

1 solution

As already noted by CPallini, you access array items out of bounds.

With array sizes of 34 items, the allowed indices are 0 to 33.
You are not only using loops generating indices of 34 but also access items inside the loops using the index plus one resulting in indices of 35.

As a result you are passing undefined values to your max and count functions.
 
Share this answer
 
Comments
TheRealSteveJudge 16-Dec-14 9:57am    
5*

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900