Here is the problem:
One sheet contains 10 labels. I want to print many labels, but from an arbitrary starting index. Now, I want to find how many sheets would be required to print the labels that the user desires. For example, let’s say I took starting index 52 and I want to print 23 labels. Then how do I find the number of sheets required? Does anyone have a formula to count this?
edit Hello guys, thanks for the answers the problem is solved now. thank u very much all.
I guess you mean that you have a predetermined page layout, i.e. if you want to print labels 42 to 67, you have to print the pages with the labels 40-49, 50-59, and 60-69.
All you need to do is find the sheet index of the starting page and the sheet index of the ending page, subtract them, and add 1. The sheet index of label n is floor(n/10) (or just n/10 with integer division). So, if your starting label is n, and you want to print x labels, the number of sheets you need is:
This all assumes zero-based indices, for sanity (that means that the first label has index 0). If your label numbers are one-based, i.e. the first label has the index 1, then you need to subtract one from n first, so the formula becomes:
This should be easy to understand.