ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Number sortation (https://www.excelbanter.com/excel-discussion-misc-queries/161810-number-sortation.html)

daffy1

Number sortation
 
I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page, 1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and 8.

Pete_UK

Number sortation
 
What happens if you have an odd number of pages to start with? Is it
increased by 1 to make it even?

Pete

On Oct 11, 10:38 pm, daffy1 wrote:
I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page, 1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and 8.




Bob I

Number sortation
 
What if there is say 22 pages?

daffy1 wrote:

Sorry, I should have said that there is only even numbers to start with.

"Pete_UK" wrote:


What happens if you have an odd number of pages to start with? Is it
increased by 1 to make it even?

Pete

On Oct 11, 10:38 pm, daffy1 wrote:

I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page, 1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and 8.






daffy1

Number sortation
 
The submitted pages must be a multiple of 4.

"Bob I" wrote:

What if there is say 22 pages?

daffy1 wrote:

Sorry, I should have said that there is only even numbers to start with.

"Pete_UK" wrote:


What happens if you have an odd number of pages to start with? Is it
increased by 1 to make it even?

Pete

On Oct 11, 10:38 pm, daffy1 wrote:

I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page, 1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and 8.






Ron Rosenfeld

Number sortation
 
On Fri, 12 Oct 2007 08:26:01 -0700, daffy1
wrote:

The submitted pages must be a multiple of 4.


Then why isn't 4 one of the allowable dividers?
--ron

David Biddulph[_2_]

Number sortation
 
What is your logic for preferring 24+16+12, and not 24+20+8 (or 20+20+12, or
20+16+16, or ...)?
--
David Biddulph

"daffy1" wrote in message
...
I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page,
1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and
8.




daffy1

Number sortation
 
For our machinery 4 is not an allowable divider.

"Ron Rosenfeld" wrote:

On Fri, 12 Oct 2007 08:26:01 -0700, daffy1
wrote:

The submitted pages must be a multiple of 4.


Then why isn't 4 one of the allowable dividers?
--ron


iliace

Number sortation
 
Assume B1 contains the sortation number (52 in your example).


B3=24 C3=Page
B4=20 C4=Page
B5=16 C5=Page
B6=12 C6=Page
B7=8 C7=Page

Use this formula in A3:
=INT(B1/B3)-IF(($B$1 - B3*INT(B1/B3))=4,1,0)

Use this formula in A4, and copy down to A5:A7
=INT(($B$1-SUMPRODUCT($A$3:A3,$B$3:B3))/B4)-IF(($B$1 - SUMPRODUCT($A
$3:A3,$B$3:B3))/B4=4,1,0)

Hope that works for you.



On Oct 12, 12:11 pm, daffy1 wrote:
For our machinery 4 is not an allowable divider.



"Ron Rosenfeld" wrote:
On Fri, 12 Oct 2007 08:26:01 -0700, daffy1
wrote:


The submitted pages must be a multiple of 4.


Then why isn't 4 one of the allowable dividers?
--ron- Hide quoted text -


- Show quoted text -




daffy1

Number sortation
 
The order I am going by is taking the largest number first (24) and then the
next largest number (20). My original number combo was wrong. So yes, this
case submitting a 52 would result in a 24 + 20 = 8. My apologies for that
oversite.

"David Biddulph" wrote:

What is your logic for preferring 24+16+12, and not 24+20+8 (or 20+20+12, or
20+16+16, or ...)?
--
David Biddulph

"daffy1" wrote in message
...
I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page,
1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and
8.





Bob I

Number sortation
 
Seems you then need to start by Subtracting the largest available
number, and work your way down.

daffy1 wrote:

For our machinery 4 is not an allowable divider.

"Ron Rosenfeld" wrote:


On Fri, 12 Oct 2007 08:26:01 -0700, daffy1
wrote:


The submitted pages must be a multiple of 4.


Then why isn't 4 one of the allowable dividers?
--ron



Dana DeLouis

Number sortation
 
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page,
1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and
8.


(ie 10110)

Hi. You mention "Only available..."

As a side note with your numbers, you selected the second of 13 possible
solutions. You may need to specify a more detailed "Rule".

FrobeniusSolve[{24,20,16,12,8},52]]

{1,1,0,0,1},
{1,0,1,1,0},
{1,0,0,1,2},
{0,2,0,1,0},
{0,1,2,0,0},
{0,1,1,0,2},
{0,1,0,2,1},
{0,1,0,0,4},
{0,0,2,1,1},
{0,0,1,3,0},
{0,0,1,1,3},
{0,0,0,3,2},
{0,0,0,1,5}

So one might think the solution is:
1*24 + 1*20 + 1*8 = 52
or
1*12+5*8 = 52
etc...

All numbers in {24,20,16,12,8} are Co-Prime, hence there are an infinite
number that can't be reproduced with these numbers.
Your page numbers can only be 8,12,16,20, ...(+4) multiples of 4.

Just to mention...
From Number Theory, if you could reduce the last page from 8 to 7, then the
Frobenius Number reduces from Infinity to 29.

FrobeniusNumber[{24,20,16,12,7}] = 29

(29 being the largest page # you can't do)
Therefore, every page number above 29 can be represented from
{24,20,16,12,7}. I don't know what your requirements are, but thought it
might be worth mentioning.

--
Dana DeLouis


"daffy1" wrote in message
...
I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page,
1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and
8.



daffy1

Number sortation
 
Sorry to make a mess of this. My only "Rule" is that given the number 52 as
an example it would have to divide into 1*24 + 1*20 + 1*8.

"Dana DeLouis" wrote:

give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page,
1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and
8.


(ie 10110)

Hi. You mention "Only available..."

As a side note with your numbers, you selected the second of 13 possible
solutions. You may need to specify a more detailed "Rule".

FrobeniusSolve[{24,20,16,12,8},52]]

{1,1,0,0,1},
{1,0,1,1,0},
{1,0,0,1,2},
{0,2,0,1,0},
{0,1,2,0,0},
{0,1,1,0,2},
{0,1,0,2,1},
{0,1,0,0,4},
{0,0,2,1,1},
{0,0,1,3,0},
{0,0,1,1,3},
{0,0,0,3,2},
{0,0,0,1,5}

So one might think the solution is:
1*24 + 1*20 + 1*8 = 52
or
1*12+5*8 = 52
etc...

All numbers in {24,20,16,12,8} are Co-Prime, hence there are an infinite
number that can't be reproduced with these numbers.
Your page numbers can only be 8,12,16,20, ...(+4) multiples of 4.

Just to mention...
From Number Theory, if you could reduce the last page from 8 to 7, then the
Frobenius Number reduces from Infinity to 29.

FrobeniusNumber[{24,20,16,12,7}] = 29

(29 being the largest page # you can't do)
Therefore, every page number above 29 can be represented from
{24,20,16,12,7}. I don't know what your requirements are, but thought it
might be worth mentioning.

--
Dana DeLouis


"daffy1" wrote in message
...
I am trying to come up with a formula to sort page counts. Example: If I
give the number 52. It has to sort into 1 24-page, 0 20-page, 1 16-page,
1
12-page and 0 8 page. The only available dividers are 24, 20, 16, 12 and
8.





All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com