# Summing specified intervals

#### pssureshbabu

##### New Member
Auswertung_2_test.xls
MNOPQR
2525DeltaEpsilon
26100000
270-10%10.100.1
2810-20%20.20.10.2
2920-50%50.60.20.3
3050-100%1010.30.4
310.40.5
320.50.6
330.60.7
340.70.8
350.80.9
360.91
3711.2
381.21.4
391.41.6
401.61.8
411.82
4222.6
432.63.2
443.23.8
453.84.4
464.45
4756
4867
4978
5089
51910
Daten

I have around 5000 values ranging from 0 to 10 in ascending order as given in cell M26. Sub task is to reduce the 5000 values down to user defined number of values in this case user input is 25 as in cell M25. After calculating the difference for each % intervals as in column O, how do I write formula to fill automatically my Column R? Here I did it manually by comparing the column N and O.

Babu

### Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

#### pssureshbabu

##### New Member
Guys, I need a macro to do the following for the above mentioned problem.

Start a cell with value = "O27"
And then go to next cell in the column which = O27+R27
Do this until the cell value = N27
Then go down the next cell which = O28 + R36
Do this until the cell value = N28
Then go down the next cell which = O29 + R41
Do this until the cell value = N29
....
....
...

Thanks

#### pssureshbabu

##### New Member
Can anybody help me with that macro? Pleaseeeeeeeeeeee

Thanks

#### SydneyGeek

##### MrExcel MVP
Put this formula in R28 and fill down:

=R27+IF(COUNTIF(\$N\$26:\$N\$30,R27)>0,INDEX(\$O\$26:\$O\$30,MATCH(R27,\$N\$26:\$N\$30,1)+2,1),INDEX(\$O\$26:\$O\$30,MATCH(R27,\$N\$26:\$N\$30,2)+1,1))

Denis

#### pssureshbabu

##### New Member
Sub test()
Dim EndRow As Integer
Dim StartRow As Integer
Dim i As Integer

StartRow = 4
EndRow = StartRow + [a2].Value - 1
j = 4
For i = StartRow To EndRow
If Cells(i - 1, "F") < Cells(j, "B").Value Then
Cells(i, "F") = Cells(i - 1, "F") + Cells(j, "C").Value
Else
j = j + 1
Cells(i, "F") = Cells(i - 1, "F") + Cells(j, "C").Value
End If
Next i
End Sub

This is the thing I needed. Anyhow thanks for everybody who looked into this problem.

Replies
1
Views
803
Replies
0
Views
377
Replies
26
Views
1K
Replies
18
Views
694
Replies
12
Views
3K

1,141,630
Messages
5,707,520
Members
421,512
Latest member
jc364698

### 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.

### Which adblocker are you using?

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

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