Macro required to split the data on specific criteria

arihanth

New Member
Joined
Jul 9, 2011
Messages
11
Hi,
I need a macro which can help me split a set of data on a particular criteria. The file is actually very large with 399327 entries of which the sample data is given below.


Time (milliseconds) Length of packet
0 ,,,,,,, 60
0.435 ,,,, 1506
1.88 ,,,, 60
2.337 ,,,, 1514
2.461 ,,,, 1514
5.428 ,,,, 60
5.828 ,,,, 1506
9.393 ,,,, 60
9.754 ,,,,, 1112
13.89 ,,,,, 60
14.309 ,,,, 1506
14.431 ,,,, 1506
14.554 ,,,, 1506
19.368 ,,,, 60
19.448 ,,,, 60
19.768 ,,,,, 1414
19.886 ,,,, 1414
20.018 ,,,, 1506
The data runs till 9000ms (900seconds).I need to split this data in the intervals of every 100 ms and create separate worksheet/workbook. Can somebody please help me with the coding for the same.
Thanks for your help in advance.
PS: Commas added in between the readings to distinguish the columns.

Regards,
Arihanth
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Welcome to the MrExcel board!

Not quite clear.

1. How does 9000 milliseconds = 900 seconds? (I would have thought 9000ms = 9s)

2. Is it correct that you have different numbers of commas separating your data. That is, can the second number in each row occur in different columns?

3. Does your sample data include a point where a break to a new sheet would be required? If so, where and why? If not, can you show us some sample data that spans a break point and explain where the breakpoint is, and why?
 
Upvote 0
Thank you for your reply.

Sorry for the typing error its 900000 milliseconds
All the data separated by comma is in the second column.
There is no brakepoint in the data. Its a continuous data which needs to be broken down into intervals of 100ms for further processing.
Thanks
 
Upvote 0
If the data in column A goes from 0 to 900,000ms and you want to split it into worksheets every 100ms, that would result in 9,000 worksheets. Is that really what you meant?! :eek:
 
Upvote 0
Hi,
Yes that's what I need to do with the data. So is there a possible solution for this. Please help.

Thanks.
 
Upvote 0
Are the 9000 sheets the end result or do you need to do further work?

Theoretically it's possible, but I think it might put a strain on system resources.
 
Upvote 0
Hi,

I will be working further on these files for my experiments as a part of my project. Thanks for the links. I will check them. :)
 
Upvote 0
Seriously, I'd only resort to dumping that data to 9000 separate sheets if there is no other way of doing what you're trying to do. There may be some process or function that can be performed on the data without splitting it and still give the results you're after.

BTW, the links are generic.
 
Upvote 0
Well the original thing which I sought to do is to find the throughput of the packets in time interval 100ms and then find different values like mean and variance for individual 100ms sets of data and then cumulatively for 15secs as well. So I thought it would be a better option to segregate the data and continue these processes. It would be helpful for me if you could suggest some other workaround to obtain these targets.
 
Upvote 0
Not sure how it would go with so much data (it may overload Excel), but one option might be to use a Pivot Table. Below I have created a new column with formula in C2 copied down then used 'Interval' as row labels and 'Length' in the data area of my Pivot Table created in columns E:F with averages shown in column F. Is that something to work with?

I would start testing with smaller data sets and see how it performs as the amount of data increases.

Excel Workbook
ABCDEFG
1TimeLengthIntervalAverage of Length
20600IntervalTotal
30.4351506001041.047619
41.886001002150
52.337151402002656
62.461151403003162
75.4286004003576
85.82815060Grand Total1918.585366
99.393600
109.7540
1113.8911120
1214.309600
1314.43115060
1414.55415060
1519.368600
1619.448600
1719.76814140
1819.88614140
1920.01815060
2038.315980
2156.58216900
2274.86417820
2393.14618740
24111.4281966100
25129.712058100
26147.9922150100
27166.2742242100
28184.5562334100
29202.8382426200
30221.122518200
31239.4022610200
32257.6842702200
33275.9662794200
34294.2482886200
35312.532978300
36330.8123070300
37349.0943162300
38367.3763254300
39385.6583346300
40403.943438400
41422.2223530400
42440.5043622400
43458.7863714400
split to columns
 
Upvote 0

Forum statistics

Threads
1,217,364
Messages
6,136,117
Members
449,993
Latest member
Sphere2215

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