Sequencing cars depending on numbers entered

Bentley_Wood

New Member
Joined
Nov 6, 2017
Messages
12
I am trying to create a spreadsheet which will automatically sequence cars depending on how many there are.

For example I want to enter:

SUV- 4
GT - 7

and the spreadsheet would create a sequence like this:

SUV, GT, GT, SUV, GT, GT, SUV, GT, SUV, GT, GT

Where possible the sequence would be:

SUV, GT, GT, SUV, GT, GT

But it could be this:

SUV, GT, SUV, GT

I hope this makes sense!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
what would the priority be, its not really evident as to why apart from more GT, the next set might have more SUV but the criteria wouldn't hold, so how do you decide, and what could be translated into machine learning
 
Upvote 0
what would the priority be, its not really evident as to why apart from more GT, the next set might have more SUV but the criteria wouldn't hold, so how do you decide, and what could be translated into machine learning

Thanks for your reply.

Priority is to mix the cars evenly through the shift so all SUV and all GT are not together.
 
Upvote 0
Hi, welcome to the forum :) - here is one option you can try.

Excel 2013/2016
ABC
SUV
GT

<colgroup><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]4[/TD]
[TD="bgcolor: #FFFF00"]SUV, GT, SUV, GT, SUV, GT, SUV, GT, GT, GT, GT[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]7[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet3

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C1[/TH]
[TD="align: left"]=MID(REPT(", "&A1&", "&A2,MIN(B1:B2))&REPT(", "&IF(B1>B2,A1,A2),ABS(B1-B2)),3,999)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Thanks, is it possible to make this formula put each SUV/GT in a separate cell and to also distribute them evenly so there are not 4x GT at the end?
 
Upvote 0
Thanks, is it possible to make this formula put each SUV/GT in a separate cell and to also distribute them evenly so there are not 4x GT at the end?

You could try this - it makes use of a few helper cells to simply things a little, formula in E2 can be copied down as far as may be required.


Excel 2013/2016
ABCDE
1SUV5GT
2GT7SUV
3GT
4GT7SUV
5SUV5GT
6Total12SUV
7Ratio1GT
8SUV
9GT
10SUV
11GT
12GT
Sheet3
Cell Formulas
RangeFormula
A4=IF(B1>B2,A1,A2)
A5=IF(B1<=B2,A1,A2)
B4=MAX(B1:B2)
B5=MIN(B1:B2)
B6=SUM(B4:B5)
B7=INT(B4/B5)
E1=IF(ROWS(E$1:E1)>$B$6,"",IF(MOD(ROWS(E$1:E1),$B$7+1),$A$4,IF((ROWS(E$1:E1)-1)/(1+$B$7)>$B$5,$A$4,$A$5)))
 
Last edited:
Upvote 0
Thanks, the only issue I have with this is sometimes it will still have a list of consecutive SUV or GT at the end.

For example when entering 7 SUV and 13 GT you get 6 consecutive GTs at the end. Is there a way to distribute these evenly?
 
Upvote 0
Is there a way to distribute these evenly?

Hi, this is as good as I can get.


Excel 2013/2016
ABCDE
1SUV7GT
2GT13GT
3SUV
4GT13GT
5SUV7GT
6Total20SUV
7Ratio2GT
8GT
9SUV
10GT
11GT
12SUV
13GT
14GT
15SUV
16GT
17GT
18SUV
19GT
20SUV
Sheet1
Cell Formulas
RangeFormula
A4=IF(B1>B2,A1,A2)
A5=IF(B1<=B2,A1,A2)
B4=MAX(B1:B2)
B5=MIN(B1:B2)
B6=SUM(B4:B5)
B7=ROUND(B4/B5,0)
E1=IF(ROWS(E$1:E1)>$B$6,"",IF(MOD(ROWS(E$1:E1),$B$7+1),IF((ROWS(E$1:E1))/($B$7+1)*$B$7>$B$4,$A$5,$A$4),IF((ROWS(E$1:E1)-1)/(1+$B$7)>$B$5,$A$4,$A$5)))
 
Upvote 0
I've been watching this and wondering is it extensible without work for four, six, nine etc vehicles
 
Upvote 0
wondering is it extensible without work for four, six, nine etc vehicles

Hi, if you mean more that just SUV and GT then no, it is not extensible - it would be starting from scratch.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,983
Messages
6,175,778
Members
452,668
Latest member
mrider123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top