VBA interval counting problem

Martin1979

New Member
Joined
Mar 29, 2013
Messages
9
Hello all,

I have a problem with the following:

I have multiple columns of numbers, which are sorted in ascending order and can be of variable length and interval, but always start at 0.
For this problem, I have selected 4 columns though.

0.000.000.000.00
0.250.30250.16000.2025
0.500.60500.32000.4050
0.750.90750.48000.6075
1.001.21000.64000.8100
1.251.51250.80001.0125
1.501.81500.96001.2150
1.752.11751.12001.4175
2.002.42001.28001.6200
2.252.72251.44001.8225
2.503.02501.60002.0250
2.753.32751.76002.2275
3.003.63001.92002.4300
3.253.93252.08002.6325
3.504.23502.24002.8350
3.754.53752.40003.0375
4.004.84002.56003.2400
4.255.14252.72003.4425
4.505.44502.88003.6450
4.755.74753.04003.8475
5.006.05003.20004.0500
5.256.35253.36004.2525
5.506.65503.52004.4550
5.756.95753.68004.6575
6.007.26003.84004.8600
6.257.56254.00005.0625
6.507.86504.16005.2650
6.758.16754.32005.4675
7.004.48005.6700
7.254.64005.8725
4.8000
4.9600
5.1200
5.2800
5.4400

<tbody>
</tbody>

Each column has a certain number, which is important to other calculations. This number can be everywhere in each column, but for ease of reference I selected 4 random numbers (bold).

Starting with the first column, the maximum value is determined via VBA (in this case 459.38). Using a user defined interval number (in this case 2), a new column is created which starts at 0 and adds 0.3 for each row until the maximum value of 7.25 has been reached.

However, the bold number is of importance too. So this value is to be included in the newly created column. So 3.25 in column 1 is to be included between 3.00 and 3.30 (see below)

0.00
0.30
0.60
0.90
1.20
1.50
1.80
2.10
2.40
2.70
3.00
3.25
3.30
3.60
3.90
4.20
4.50
4.80
5.10
5.40
5.70
6.00
6.30
6.60
6.90
7.20

<tbody>
</tbody>

After the first column, the other colums will get new intervals in a similar fashion as presented above. However, there will also be a fixed value added to each newly created row (interval), based on the value in the previous column. As example, a value of 0.2 has been used. In this case, the bold values will need to be included also.

0.000.200.400.60
0.300.500.700.90
0.600.801.001.20
0.901.101.301.50
1.201.401.601.80
1.501.701.902.025
1.802.001.922.10
2.102.302.202.40
2.402.422.502.70
2.702.602.803.00
3.002.903.103.30
3.253.203.403.60
3.303.503.703.90
3.603.804.004.20
3.904.104.304.50
4.204.404.604.80
4.504.704.905.10
4.805.005.205.40
5.105.305.70
5.405.60
5.705.90
6.006.20
6.306.50
6.606.80
6.907.10
7.207.40
7.70
8.00

<tbody>
</tbody>

However, the above table is incorrect and this is where my problem comes into play. Every time the bold value of the applicable column is inserted, the table needs to get a new line and the preceding and following columns need to get a new value, based on the bold value of the applicable column and user defined interval. The table below shows the result, the red marked values are the original values of the applicable column, which need to be included and the blue values are a result of this red value.

0.000.200.400.60
0.300.500.700.90
0.600.801.001.20
0.901.101.301.50
1.201.401.601.80
1.4251.6251.8252.025
1.501.701.902.10
1.521.721.922.12
1.802.002.202.40
2.102.302.502.70
2.122.422.622.82
2.402.602.803.00
2.702.903.103.30
3.003.203.403.60
3.253.453.653.85
3.303.503.703.90
3.603.804.004.20
3.904.104.304.50
4.204.404.604.80
4.504.704.905.10
4.805.005.205.40
5.105.305.70
5.405.60
5.705.90
6.006.20
6.306.50
6.606.80
6.907.10
7.207.40
7.70
8.00

<tbody>
</tbody>

Can anyone help me with this problem? I am looking for a VBA solution for this problem.

Many thanks in advance,
Martin
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Can someone please help me with the above question? I do not know how I can get these bold figures in the columns using VBA. For the first column, I succeeded in getting the first bold value in but, for the other columns, I do not know how to adjust each column and include the remaining bold values.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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