View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
OdAwG OdAwG is offline
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