ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   separate data with extra column (https://www.excelbanter.com/excel-programming/413103-separate-data-extra-column.html)

smandula

separate data with extra column
 
I am trying to line up data from Sheet 2 to Sheet 1.
In sheet2 data start on row 2 with date col A, number col B, number
col C, number col D
06/18/2008 1 5 3

This is data for Pick Three Lottery. The following VBA works if Sheet
1 has
date - col1 and continuous columns 2 to 10

Sub Newer2() 'Final Code
Dim rCell As Range
Dim rCell2 As Range

For Each rCell2 In Sheet2.Range("A2:A15")
With Sheet1.Range(rCell2.Offset(0, 0).Address)
.Value = rCell2.Value
For Each rCell In rCell2.Offset(0, 1).Resize(1, 3)
.Offset(0, rCell.Value).Value = rCell.Value
Next rCell
End With
Next rCell2

End Sub

However, the above works if there are no double numbers 522 or 242,
or triple numbers 222. To compensate for this I have added an extra
column
beside each of the original columns. So that it looks like:

date col 1 * col 2 * col 3 * col 4 * col 5 * col 6 * col 7 * col 8 *
col 9 * col 10 *

the extra column * hold the overflow 2 of 522 for example
this way I can calculate the frequency of single double triple
numbers,
by suming col + * as a total.

Unfortunately, 0 is 10; as columns start at 1, something you have to
live with.

Any suggestions would be appreciated. Picking three numbers based on
frequency
does sometimes work.





All times are GMT +1. The time now is 02:48 PM.

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