|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Google Sheets OPR Calculator
Quote:
I think you missed the boat here. Your code has three passes through the matches, and the final pass has an inner loop which loops through the teams. The pseudo-code I posted does a single pass through the 8col match data, with no inner loops in that single pass. That single pass accomplishes everything you need. Give it a try! |
|
#2
|
|||
|
|||
|
Re: Google Sheets OPR Calculator
Quote:
I also figured out what's taking so much time: it's the repeated .getRange().setValue(). There's another function, setValues() that allows me to print the entire array at once that really speeds it up. However, the array must be a consistent size, so I had to keep the loop to create T so I could initialize A. It also seems like fill() doesn't work in scripts, so I had to loop through T to set A to zero, otherwise when I printed out A it'd be filled with "NOT_FOUND". I did cut out the loop for b (not sure why I had it there in the first place). Although I did manage to implement your pseudo-code, the only method I found to make that work would be to print A directly (instead of creating the array first), which took longer than looping. It also results in the OPRs not being sorted, which is a convenience I'd sacrifice a bit of time for. Hopefully that now addresses your point? I'll post my updated code once I clean it up a bit. |
|
#3
|
||||||
|
||||||
|
Re: Google Sheets OPR Calculator
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
![]() Last edited by Ether : 28-10-2016 at 18:21. |
|
#4
|
||||||
|
||||||
|
Re: Google Sheets OPR Calculator
Quote:
Array values are set to null (I think--if I set a cell value to that, it comes out as either "undefined" or "NOT_FOUND" depending on whether I set an individual cell or range) Quote:
Quote:
Quote:
Quote:
Quote:
This has been an interesting conversation though, so thank you for that. I will be updating the posted spreadsheet with the new script soon (currently cleaning it up a bit, but it should be up by tonight) for anyone who wants it. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|