So, I am having quite the difficult time coming up with the logic for this one...
To explain it as simply as possible, I have a helper column (used for other things, but should prove useful in this case) with numbers ascending until the value changes in a different column, then they reset to 1. What I want to do is insert a page break so there is never the same values on different pages. So if by default, every 46 lines after a page break, another is automatically inserted, that would be our maximum value. so it would be the closest to 46 lines without exceeding 46 lines, with a 1 in the column next to it. I provided example "line counts" in the first column, those don't need to be there, it is more or less to help illustrate what I tried to explain. I can see counting backwards from 46 also being useful, so don't let my "help" hinder you when coming up with possibilities for logic. Adding in more helper columns is also an option, feel free to brute force this however you deem necessary.
Once this is solved, I can nest this formula with my other formula that decides page breaks based on a different criteria, to automatically decide where they should be, then a macro can do the rest. The problem I am having with this is the extremely fuzzy logic of some number less than or equal to 46 with a strange variable criteria like that. Any and all help will be greatly appreciated, I'll keep trying to come up with my own solution in the meantime of course.
Example data below, notice how it adjusts so all the nnn's remain on the same page:
formula helper values count starts here 1 aaa 2 2 aaa 3 3 aaa 4 4 aaa 5 1 bbb 6 2 bbb 7 3 bbb 8 1 ccc 9 1 ddd 10 2 ddd 11 3 ddd 12 4 ddd 13 5 ddd 14 1 eee 15 2 eee 16 3 eee 17 1 fff 18 1 ggg 19 1 hhh 20 1 iii 21 2 iii 22 3 iii 23 4 iii 24 1 jjj 25 2 jjj 26 3 jjj 27 4 jjj 28 5 jjj 29 1 kkk 30 2 kkk 31 3 kkk 32 4 kkk 33 1 lll 34 2 lll 35 3 lll 36 4 lll 37 5 lll 38 1 mmm 39 2 mmm 40 3 mmm 41 4 mmm 42 5 mmm 43 6 mmm page break (44) 1 nnn 2 (45) 2 nnn 3 (46) 3 nnn 4 4 nnn 5 5 nnn 6 6 nnn 7 1 ooo 8 2 ooo 9 3 ooo 10 4 ooo 11 5 ooo 12 1 ppp 13 2 ppp 14 3 ppp 15 4 ppp 16 5 ppp 17 1 qqq 18 2 qqq 19 3 qqq 20 4 qqq 21 1 rrr 22 2 rrr 23 3 rrr 24 4 rrr 25 1 sss 26 2 sss 27 3 sss 28 4 sss 29 5 sss 30 6 sss 31 1 ttt 32 2 ttt 33 3 ttt 34 4 ttt 35 1 uuu 36 2 uuu 37 3 uuu 38 1 vvv 39 2 vvv 40 3 vvv 41 1 www 42 2 www 43 3 www 44 1 xxx 45 2 xxx 46 3 xxx page break 1 yyy 2 1 zzz 3 2 zzz 4 3 zzz 5 4 zzz 6 1 AAAA 7 2 AAAA 8 3 AAAA 9 4 AAAA etc. etc. etc.
Bookmarks