Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Help with Table Automation

Hello All,

My question is, how can I do this automatically with a macro or with a high
speed low drag formula. I took this over from someone who was doing it
manually on paper and I converted it into a spreadsheet. It's only been
three months into the new year and I find this very tedious and I now know
why that person no longer wanted to do this.

Given the following names listed below with the number of entries, I need to
figure out how many table columns needs to be created and put each name in
each table column only once by their corresponding entries. In the example
below, we have a total of 36 entries (adding up all the entries). To get
the total numbers of tables to create, I divided 36 by 8 (8 names per table)
and that gives me a total of 5 table columns to create.


Oscar Delahoya 5
Quincy Jones 5
Xiasha Jones 5
Adam Doe 4
chucky cheese 4
David Crocket 4
Frank Valins 4
Robert Ronins 4
Kent Clark 1
------------------
36/8 = 4.5 or 5 tables

Table1 Table2 Table3 Table4 Table5
------------------------------------------------
Oscar Oscar Oscar Oscar Oscar
Quincy Quincy Quincy Quincy Quincy
Xiasha Xiasha Xiasha Xiasha Xiasha
Adam Adam Adam Adam Kent
Chucky Chucky Chucky Chucky
David David David David
Frank Frank Frank Frank
Robert Robert Robert Robert

Any and all help in this matter is GREATLY APPRECIATED :)

Argus


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Help with Table Automation

I don't think you explained how you got that second layout--well, not enough for
me to understand.

I don't see why Chucky Cheese couldn't be in the 5th table--right next to the
4th Adam Doe entry. Then Chucky Cheese could be continued on the next line in
tables 1-3.

Then David Crocket would pick up in the next column (table 4, table 5), then the
next row tables 1 and 2.

And so forth.

If this kind of layout is ok:

Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya
Quincy Jones Quincy Jones Quincy Jones Quincy Jones Quincy Jones
Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones
Adam Doe Adam Doe Adam Doe Adam Doe chucky cheese
chucky cheese chucky cheese chucky cheese David Crocket David Crocket
David Crocket David Crocket Frank Valins Frank Valins Frank Valins
Frank Valins Robert Ronins Robert Ronins Robert Ronins Robert Ronins
Kent Clark

Just filling them up across the tables, then going to the next row, then you
could use a macro like:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \ HowManyPerTable

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value
If HowManyForThisPerson HowManyTables Then
MsgBox "not enough tables for: " & ThisPerson _
& "Stopping!"
Exit Sub
End If

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub

And I don't understand what would happen if Oscar had 6 entries????

Maybe the maximum number of tables should be the based on the max number at the
table and the number of entries--along with the maximum number of entries any
one person has???

So if Oscar had 7 entries, but the calculation showed 5 tables were necessary,
then you'd end up going with 7 tables.




OdAwG wrote:

Hello All,

My question is, how can I do this automatically with a macro or with a high
speed low drag formula. I took this over from someone who was doing it
manually on paper and I converted it into a spreadsheet. It's only been
three months into the new year and I find this very tedious and I now know
why that person no longer wanted to do this.

Given the following names listed below with the number of entries, I need to
figure out how many table columns needs to be created and put each name in
each table column only once by their corresponding entries. In the example
below, we have a total of 36 entries (adding up all the entries). To get
the total numbers of tables to create, I divided 36 by 8 (8 names per table)
and that gives me a total of 5 table columns to create.

Oscar Delahoya 5
Quincy Jones 5
Xiasha Jones 5
Adam Doe 4
chucky cheese 4
David Crocket 4
Frank Valins 4
Robert Ronins 4
Kent Clark 1
------------------
36/8 = 4.5 or 5 tables

Table1 Table2 Table3 Table4 Table5
------------------------------------------------
Oscar Oscar Oscar Oscar Oscar
Quincy Quincy Quincy Quincy Quincy
Xiasha Xiasha Xiasha Xiasha Xiasha
Adam Adam Adam Adam Kent
Chucky Chucky Chucky Chucky
David David David David
Frank Frank Frank Frank
Robert Robert Robert Robert

Any and all help in this matter is GREATLY APPRECIATED :)

Argus


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Help with Table Automation

Hey Dave,

Sorry for not being clear.

Let me try again:
001. The total number of table columns created depends on the total number
of entries.
002. To calculate the total number of tables columns, add up all entries
and divide by 8
003. Each table can only have a max of 8 names per table.
004. No duplications of names in the table columns. So, if Oscar has 5,
then his name should
should appear in five (5) separate tables.

I like the way you've done it in the your code below. I guess what needs to
happen first then is to sort the entry column first decended to get the
highest numeric value up top first to create the total number of table
columns to create.

But, i think the tables should be filled first with eight (8) names before
moving to the next table. What do you think?

Argus


"Dave Peterson" wrote in message
...
I don't think you explained how you got that second layout--well, not
enough for
me to understand.

I don't see why Chucky Cheese couldn't be in the 5th table--right next to
the
4th Adam Doe entry. Then Chucky Cheese could be continued on the next
line in
tables 1-3.

Then David Crocket would pick up in the next column (table 4, table 5),
then the
next row tables 1 and 2.

And so forth.

If this kind of layout is ok:

Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya
Quincy Jones Quincy Jones Quincy Jones Quincy Jones Quincy Jones
Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones
Adam Doe Adam Doe Adam Doe Adam Doe chucky cheese
chucky cheese chucky cheese chucky cheese David Crocket David Crocket
David Crocket David Crocket Frank Valins Frank Valins Frank Valins
Frank Valins Robert Ronins Robert Ronins Robert Ronins Robert Ronins
Kent Clark

Just filling them up across the tables, then going to the next row, then
you
could use a macro like:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \
HowManyPerTable

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value
If HowManyForThisPerson HowManyTables Then
MsgBox "not enough tables for: " & ThisPerson _
& "Stopping!"
Exit Sub
End If

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub

And I don't understand what would happen if Oscar had 6 entries????

Maybe the maximum number of tables should be the based on the max number
at the
table and the number of entries--along with the maximum number of entries
any
one person has???

So if Oscar had 7 entries, but the calculation showed 5 tables were
necessary,
then you'd end up going with 7 tables.




OdAwG wrote:

Hello All,

My question is, how can I do this automatically with a macro or with a
high
speed low drag formula. I took this over from someone who was doing it
manually on paper and I converted it into a spreadsheet. It's only been
three months into the new year and I find this very tedious and I now
know
why that person no longer wanted to do this.

Given the following names listed below with the number of entries, I need
to
figure out how many table columns needs to be created and put each name
in
each table column only once by their corresponding entries. In the
example
below, we have a total of 36 entries (adding up all the entries). To get
the total numbers of tables to create, I divided 36 by 8 (8 names per
table)
and that gives me a total of 5 table columns to create.

Oscar Delahoya 5
Quincy Jones 5
Xiasha Jones 5
Adam Doe 4
chucky cheese 4
David Crocket 4
Frank Valins 4
Robert Ronins 4
Kent Clark 1
------------------
36/8 = 4.5 or 5 tables

Table1 Table2 Table3 Table4 Table5
------------------------------------------------
Oscar Oscar Oscar Oscar Oscar
Quincy Quincy Quincy Quincy Quincy
Xiasha Xiasha Xiasha Xiasha Xiasha
Adam Adam Adam Adam Kent
Chucky Chucky Chucky Chucky
David David David David
Frank Frank Frank Frank
Robert Robert Robert Robert

Any and all help in this matter is GREATLY APPRECIATED :)

Argus


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Help with Table Automation

You can determine the maximum number of tables without sorting. Just like
using: =max(b1:b99) in a worksheet.

And I see no compelling reason to fill each table with 8 names first. So I
wouldn't bother. In fact, I would think that populating each table so that
they're approximately the same size (give or take one) would be better than
having 4 tables with 8 and one table with 1.

But I really don't understand what you're doing.

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim MaxEntries As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \ HowManyPerTable

MaxEntries = Application.Max(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))

If HowManyTables < MaxEntries Then
HowManyTables = MaxEntries
End If

If TotalEntries HowManyPerTable * HowManyTables Then
MsgBox "Something has to give--not enough room in the table"
Exit Sub
End If

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub



OdAwG wrote:

Hey Dave,

Sorry for not being clear.

Let me try again:
001. The total number of table columns created depends on the total number
of entries.
002. To calculate the total number of tables columns, add up all entries
and divide by 8
003. Each table can only have a max of 8 names per table.
004. No duplications of names in the table columns. So, if Oscar has 5,
then his name should
should appear in five (5) separate tables.

I like the way you've done it in the your code below. I guess what needs to
happen first then is to sort the entry column first decended to get the
highest numeric value up top first to create the total number of table
columns to create.

But, i think the tables should be filled first with eight (8) names before
moving to the next table. What do you think?

Argus

"Dave Peterson" wrote in message
...
I don't think you explained how you got that second layout--well, not
enough for
me to understand.

I don't see why Chucky Cheese couldn't be in the 5th table--right next to
the
4th Adam Doe entry. Then Chucky Cheese could be continued on the next
line in
tables 1-3.

Then David Crocket would pick up in the next column (table 4, table 5),
then the
next row tables 1 and 2.

And so forth.

If this kind of layout is ok:

Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya
Quincy Jones Quincy Jones Quincy Jones Quincy Jones Quincy Jones
Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones
Adam Doe Adam Doe Adam Doe Adam Doe chucky cheese
chucky cheese chucky cheese chucky cheese David Crocket David Crocket
David Crocket David Crocket Frank Valins Frank Valins Frank Valins
Frank Valins Robert Ronins Robert Ronins Robert Ronins Robert Ronins
Kent Clark

Just filling them up across the tables, then going to the next row, then
you
could use a macro like:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \
HowManyPerTable

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value
If HowManyForThisPerson HowManyTables Then
MsgBox "not enough tables for: " & ThisPerson _
& "Stopping!"
Exit Sub
End If

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub

And I don't understand what would happen if Oscar had 6 entries????

Maybe the maximum number of tables should be the based on the max number
at the
table and the number of entries--along with the maximum number of entries
any
one person has???

So if Oscar had 7 entries, but the calculation showed 5 tables were
necessary,
then you'd end up going with 7 tables.




OdAwG wrote:

Hello All,

My question is, how can I do this automatically with a macro or with a
high
speed low drag formula. I took this over from someone who was doing it
manually on paper and I converted it into a spreadsheet. It's only been
three months into the new year and I find this very tedious and I now
know
why that person no longer wanted to do this.

Given the following names listed below with the number of entries, I need
to
figure out how many table columns needs to be created and put each name
in
each table column only once by their corresponding entries. In the
example
below, we have a total of 36 entries (adding up all the entries). To get
the total numbers of tables to create, I divided 36 by 8 (8 names per
table)
and that gives me a total of 5 table columns to create.

Oscar Delahoya 5
Quincy Jones 5
Xiasha Jones 5
Adam Doe 4
chucky cheese 4
David Crocket 4
Frank Valins 4
Robert Ronins 4
Kent Clark 1
------------------
36/8 = 4.5 or 5 tables

Table1 Table2 Table3 Table4 Table5
------------------------------------------------
Oscar Oscar Oscar Oscar Oscar
Quincy Quincy Quincy Quincy Quincy
Xiasha Xiasha Xiasha Xiasha Xiasha
Adam Adam Adam Adam Kent
Chucky Chucky Chucky Chucky
David David David David
Frank Frank Frank Frank
Robert Robert Robert Robert

Any and all help in this matter is GREATLY APPRECIATED :)

Argus


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Help with Table Automation

Hey David,

Oh cool, thanks for the help.

I guess to make things all clear, what I am trying to do is automate a
bracket sheet that we can use for bowling. People would sign up to enter
into brackets. All they would have to do is give their names and the number
of brackets they want. The 8 bracket sheet is used (because we only bowl 3
games).

Game1 Game2 Game3

----------|
|--------|
----------| |
|------|
----------| | |
|--------| |
----------| |
|-----------
----------| |
|--------| |
----------| | |
|------|
----------| |
|--------|
----------|

In order to do a bracket sheet like above, we have to have the names filled
in. I thought the best way was to create a master sheet with only the
bowlers name and number of brackets entered. Based on the number of
brackets entry, will determing the number of brackets to use. That is what
we were trying to accomplish. I wanted to do this automatically with a
macro so that we wouldn't do it manually week to week.

Once the tables or brackets were completed, I already have a macro that
would copy those names over to the bracket sheets and then randomize them
into the bracket itself.

001. take table1 and copy to a sheet called bracket1 (do the same with each
table)
002. Once on the bracket sheet, I would randomize the name and place them
in the brackets

Does that make it more clearer? I know what I want to say but typing it out
is has been a challenge. hehe ahhah LOL :)

Argus



"Dave Peterson" wrote in message
...
You can determine the maximum number of tables without sorting. Just like
using: =max(b1:b99) in a worksheet.

And I see no compelling reason to fill each table with 8 names first. So
I
wouldn't bother. In fact, I would think that populating each table so
that
they're approximately the same size (give or take one) would be better
than
having 4 tables with 8 and one table with 1.

But I really don't understand what you're doing.

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim MaxEntries As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \
HowManyPerTable

MaxEntries = Application.Max(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))

If HowManyTables < MaxEntries Then
HowManyTables = MaxEntries
End If

If TotalEntries HowManyPerTable * HowManyTables Then
MsgBox "Something has to give--not enough room in the table"
Exit Sub
End If

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub



OdAwG wrote:

Hey Dave,

Sorry for not being clear.

Let me try again:
001. The total number of table columns created depends on the total
number
of entries.
002. To calculate the total number of tables columns, add up all entries
and divide by 8
003. Each table can only have a max of 8 names per table.
004. No duplications of names in the table columns. So, if Oscar has 5,
then his name should
should appear in five (5) separate tables.

I like the way you've done it in the your code below. I guess what needs
to
happen first then is to sort the entry column first decended to get the
highest numeric value up top first to create the total number of table
columns to create.

But, i think the tables should be filled first with eight (8) names
before
moving to the next table. What do you think?

Argus

"Dave Peterson" wrote in message
...
I don't think you explained how you got that second layout--well, not
enough for
me to understand.

I don't see why Chucky Cheese couldn't be in the 5th table--right next
to
the
4th Adam Doe entry. Then Chucky Cheese could be continued on the next
line in
tables 1-3.

Then David Crocket would pick up in the next column (table 4, table 5),
then the
next row tables 1 and 2.

And so forth.

If this kind of layout is ok:

Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar
Delahoya
Quincy Jones Quincy Jones Quincy Jones Quincy Jones Quincy
Jones
Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones Xiasha
Jones
Adam Doe Adam Doe Adam Doe Adam Doe chucky
cheese
chucky cheese chucky cheese chucky cheese David Crocket David
Crocket
David Crocket David Crocket Frank Valins Frank Valins Frank
Valins
Frank Valins Robert Ronins Robert Ronins Robert Ronins Robert
Ronins
Kent Clark

Just filling them up across the tables, then going to the next row,
then
you
could use a macro like:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow,
"B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \
HowManyPerTable

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value
If HowManyForThisPerson HowManyTables Then
MsgBox "not enough tables for: " & ThisPerson _
& "Stopping!"
Exit Sub
End If

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub

And I don't understand what would happen if Oscar had 6 entries????

Maybe the maximum number of tables should be the based on the max
number
at the
table and the number of entries--along with the maximum number of
entries
any
one person has???

So if Oscar had 7 entries, but the calculation showed 5 tables were
necessary,
then you'd end up going with 7 tables.




OdAwG wrote:

Hello All,

My question is, how can I do this automatically with a macro or with a
high
speed low drag formula. I took this over from someone who was doing
it
manually on paper and I converted it into a spreadsheet. It's only
been
three months into the new year and I find this very tedious and I now
know
why that person no longer wanted to do this.

Given the following names listed below with the number of entries, I
need
to
figure out how many table columns needs to be created and put each
name
in
each table column only once by their corresponding entries. In the
example
below, we have a total of 36 entries (adding up all the entries). To
get
the total numbers of tables to create, I divided 36 by 8 (8 names per
table)
and that gives me a total of 5 table columns to create.

Oscar Delahoya 5
Quincy Jones 5
Xiasha Jones 5
Adam Doe 4
chucky cheese 4
David Crocket 4
Frank Valins 4
Robert Ronins 4
Kent Clark 1
------------------
36/8 = 4.5 or 5 tables

Table1 Table2 Table3 Table4 Table5
------------------------------------------------
Oscar Oscar Oscar Oscar Oscar
Quincy Quincy Quincy Quincy Quincy
Xiasha Xiasha Xiasha Xiasha Xiasha
Adam Adam Adam Adam Kent
Chucky Chucky Chucky Chucky
David David David David
Frank Frank Frank Frank
Robert Robert Robert Robert

Any and all help in this matter is GREATLY APPRECIATED :)

Argus

--

Dave Peterson


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Help with Table Automation

I think you could do that with the table that's created from that second macro.

You could fill in the empty cells with "bye" so that any bracket with less than
8 entries would have some players that advance to the second round. (I'd try to
make it so that no bye played a bye, though.)

And, to me, it makes more sense to fill them the way the macro did--you'd never
end up with one bracket with just 1 name.



OdAwG wrote:

Hey David,

Oh cool, thanks for the help.

I guess to make things all clear, what I am trying to do is automate a
bracket sheet that we can use for bowling. People would sign up to enter
into brackets. All they would have to do is give their names and the number
of brackets they want. The 8 bracket sheet is used (because we only bowl 3
games).

Game1 Game2 Game3

----------|
|--------|
----------| |
|------|
----------| | |
|--------| |
----------| |
|-----------
----------| |
|--------| |
----------| | |
|------|
----------| |
|--------|
----------|

In order to do a bracket sheet like above, we have to have the names filled
in. I thought the best way was to create a master sheet with only the
bowlers name and number of brackets entered. Based on the number of
brackets entry, will determing the number of brackets to use. That is what
we were trying to accomplish. I wanted to do this automatically with a
macro so that we wouldn't do it manually week to week.

Once the tables or brackets were completed, I already have a macro that
would copy those names over to the bracket sheets and then randomize them
into the bracket itself.

001. take table1 and copy to a sheet called bracket1 (do the same with each
table)
002. Once on the bracket sheet, I would randomize the name and place them
in the brackets

Does that make it more clearer? I know what I want to say but typing it out
is has been a challenge. hehe ahhah LOL :)

Argus

"Dave Peterson" wrote in message
...
You can determine the maximum number of tables without sorting. Just like
using: =max(b1:b99) in a worksheet.

And I see no compelling reason to fill each table with 8 names first. So
I
wouldn't bother. In fact, I would think that populating each table so
that
they're approximately the same size (give or take one) would be better
than
having 4 tables with 8 and one table with 1.

But I really don't understand what you're doing.

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim MaxEntries As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \
HowManyPerTable

MaxEntries = Application.Max(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow, "B")))

If HowManyTables < MaxEntries Then
HowManyTables = MaxEntries
End If

If TotalEntries HowManyPerTable * HowManyTables Then
MsgBox "Something has to give--not enough room in the table"
Exit Sub
End If

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub



OdAwG wrote:

Hey Dave,

Sorry for not being clear.

Let me try again:
001. The total number of table columns created depends on the total
number
of entries.
002. To calculate the total number of tables columns, add up all entries
and divide by 8
003. Each table can only have a max of 8 names per table.
004. No duplications of names in the table columns. So, if Oscar has 5,
then his name should
should appear in five (5) separate tables.

I like the way you've done it in the your code below. I guess what needs
to
happen first then is to sort the entry column first decended to get the
highest numeric value up top first to create the total number of table
columns to create.

But, i think the tables should be filled first with eight (8) names
before
moving to the next table. What do you think?

Argus

"Dave Peterson" wrote in message
...
I don't think you explained how you got that second layout--well, not
enough for
me to understand.

I don't see why Chucky Cheese couldn't be in the 5th table--right next
to
the
4th Adam Doe entry. Then Chucky Cheese could be continued on the next
line in
tables 1-3.

Then David Crocket would pick up in the next column (table 4, table 5),
then the
next row tables 1 and 2.

And so forth.

If this kind of layout is ok:

Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar Delahoya Oscar
Delahoya
Quincy Jones Quincy Jones Quincy Jones Quincy Jones Quincy
Jones
Xiasha Jones Xiasha Jones Xiasha Jones Xiasha Jones Xiasha
Jones
Adam Doe Adam Doe Adam Doe Adam Doe chucky
cheese
chucky cheese chucky cheese chucky cheese David Crocket David
Crocket
David Crocket David Crocket Frank Valins Frank Valins Frank
Valins
Frank Valins Robert Ronins Robert Ronins Robert Ronins Robert
Ronins
Kent Clark

Just filling them up across the tables, then going to the next row,
then
you
could use a macro like:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

Dim oRow As Long
Dim oCol As Long

Dim HowManyPerTable As Long
Dim TotalEntries As Long
Dim HowManyTables As Long
Dim ThisPerson As String
Dim HowManyForThisPerson As Long
Dim hCtr As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

HowManyPerTable = 8

With CurWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
TotalEntries = Application.Sum(.Range(.Cells(FirstRow, "B"), _
.Cells(LastRow,
"B")))
HowManyTables = (TotalEntries + HowManyPerTable - 1) \
HowManyPerTable

oRow = 0
oCol = 999999
For iRow = FirstRow To LastRow
ThisPerson = .Cells(iRow, "A").Value
HowManyForThisPerson = .Cells(iRow, "B").Value
If HowManyForThisPerson HowManyTables Then
MsgBox "not enough tables for: " & ThisPerson _
& "Stopping!"
Exit Sub
End If

For hCtr = 1 To HowManyForThisPerson
If oCol = HowManyTables Then
oRow = oRow + 1
oCol = 1
Else
oCol = oCol + 1
End If
NewWks.Cells(oRow, oCol).Value = ThisPerson
Next hCtr
Next iRow
End With
End Sub

And I don't understand what would happen if Oscar had 6 entries????

Maybe the maximum number of tables should be the based on the max
number
at the
table and the number of entries--along with the maximum number of
entries
any
one person has???

So if Oscar had 7 entries, but the calculation showed 5 tables were
necessary,
then you'd end up going with 7 tables.




OdAwG wrote:

Hello All,

My question is, how can I do this automatically with a macro or with a
high
speed low drag formula. I took this over from someone who was doing
it
manually on paper and I converted it into a spreadsheet. It's only
been
three months into the new year and I find this very tedious and I now
know
why that person no longer wanted to do this.

Given the following names listed below with the number of entries, I
need
to
figure out how many table columns needs to be created and put each
name
in
each table column only once by their corresponding entries. In the
example
below, we have a total of 36 entries (adding up all the entries). To
get
the total numbers of tables to create, I divided 36 by 8 (8 names per
table)
and that gives me a total of 5 table columns to create.

Oscar Delahoya 5
Quincy Jones 5
Xiasha Jones 5
Adam Doe 4
chucky cheese 4
David Crocket 4
Frank Valins 4
Robert Ronins 4
Kent Clark 1
------------------
36/8 = 4.5 or 5 tables

Table1 Table2 Table3 Table4 Table5
------------------------------------------------
Oscar Oscar Oscar Oscar Oscar
Quincy Quincy Quincy Quincy Quincy
Xiasha Xiasha Xiasha Xiasha Xiasha
Adam Adam Adam Adam Kent
Chucky Chucky Chucky Chucky
David David David David
Frank Frank Frank Frank
Robert Robert Robert Robert

Any and all help in this matter is GREATLY APPRECIATED :)

Argus

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automation Allenc Excel Worksheet Functions 5 January 13th 07 10:42 AM
Automation Error xlEnt Excel Discussion (Misc queries) 2 May 15th 06 11:37 PM
Automation?? Help in automation Excel Discussion (Misc queries) 1 April 12th 06 02:10 PM
automation Darius New Users to Excel 1 September 23rd 05 07:37 AM
Automation issue Dimmer Excel Discussion (Misc queries) 1 June 30th 05 11:38 AM


All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"