Find automatic range

neam

New Member
Joined
Jan 20, 2025
Messages
11
Office Version
  1. 2010
Platform
  1. Windows
Hi everyone
I want to intelligently calculate the average of that range by selecting the station column wherever kilometers change.
PointStationOffsetElevationCross Section Station
3059.6717.478102.039m110
3169.80-3.148101.528m1
3179.81-5.016101.847m1
3069.8713.996102.240m1
3229.88-8.795102.262m1
3239.91-10.798102.156m1
3209.92-5.409102.796m1
3219.96-6.64102.909m1
31210.022.451101.650m1
31110.054.907101.974m1
31010.105.274102.553m1
30710.1210.049102.283m1
30810.137.144102.126m1
30910.146.308102.410m1
32510.18-16.117102.011m1
32410.23-13.882102.200m047
30146.158.529102.155m1
30246.2011.863102.114m1
29846.224.401102.413m1
29746.233.906101.869m1
29646.312.787101.573m1
29946.315.195102.666m1
30046.335.941102.636m1
29246.59-2.705101.492m1
29146.61-4.625102.073m1
29046.68-5.085102.636m1
28946.75-6.38102.617m1
30346.8716.48102.016m1
28846.91-7.312102.106m1
28746.93-8.603102.044m1
28346.96-14.173102.307m1
28546.97-11.047101.835m1
28446.98-13.418101.878m1
28646.99-9.779102.491m1
28146.99-15.712101.918m1
28246.99-14.822102.368m1
28047.14-21.221101.914m1
27947.15-26.622101.843m1
30448.6218.268102.049m0141
 
As long as the absolute value of the difference between the first and second numbers, the second and third numbers, etc., is between zero and two, the average of the numbers in this range is calculated.
This would also have been an incredible guess from the information in post #1 :eek:

Would this be any use?

25 01 21.xlsm
ABC
1StationFormula
29.6661010
39.796 
49.809 
59.866 
69.882 
79.907 
89.916 
99.955 
1010.024 
1110.046 
1210.095 
1310.117 
1410.128 
1510.142 
1610.178 
1710.22547 
1846.15347
1946.204 
2046.221 
2146.225 
2246.307 
2346.309 
2446.325 
2546.59 
2646.612 
2746.681 
2846.753 
2946.87 
3046.914 
3146.929 
3246.955 
3346.966 
3446.976 
3546.988 
3646.99 
3746.993 
3847.139 
3947.149 
4048.624141 
41140.542141
Average
Cell Formulas
RangeFormula
C2:C41C2=IF(ABS(A2-N(A1))>2,ROUND(AVERAGE(A2:INDEX(A:A,ROW()+MATCH(TRUE,ABS(A2:A100-A3:A101)>2,0)-1)),0),"")
 
Upvote 0
Solution

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
CivilReport1.xls
ABC
1StationFormula
29.66610#VALUE!
39.796 
49.809 
59.866 
69.882 
79.907 
89.916 
99.955 
1010.024 
1110.046 
1210.095 
1310.117 
1410.128 
1510.142 
1610.178 
1710.22547 
1846.153#VALUE!
1946.204 
2046.221 
2146.225 
2246.307 
2346.309 
2446.325 
2546.59 
2646.612 
2746.681 
2846.753 
2946.87 
3046.914 
3146.929 
3246.955 
3346.966 
3446.976 
3546.988 
3646.99 
3746.993 
3847.139 
3947.149 
4048.624141 
41140.542#VALUE!
Sheet1
Cell Formulas
RangeFormula
C2:C41C2=IF(ABS(A2-N(A1))>2,ROUND(AVERAGE(A2:INDEX(A:A,ROW()+MATCH(TRUE,ABS(A2:A100-A3:A101)>2,0)-1)),0),"")
 
Upvote 0
This would also have been an incredible guess from the information in post #1 :eek:

Would this be any use?

25 01 21.xlsm
ABC
1StationFormula
29.6661010
39.796 
49.809 
59.866 
69.882 
79.907 
89.916 
99.955 
1010.024 
1110.046 
1210.095 
1310.117 
1410.128 
1510.142 
1610.178 
1710.22547 
1846.15347
1946.204 
2046.221 
2146.225 
2246.307 
2346.309 
2446.325 
2546.59 
2646.612 
2746.681 
2846.753 
2946.87 
3046.914 
3146.929 
3246.955 
3346.966 
3446.976 
3546.988 
3646.99 
3746.993 
3847.139 
3947.149 
4048.624141 
41140.542141
Average
Cell Formulas
RangeFormula
C2:C41C2=IF(ABS(A2-N(A1))>2,ROUND(AVERAGE(A2:INDEX(A:A,ROW()+MATCH(TRUE,ABS(A2:A100-A3:A101)>2,0)-1)),0),"")
Why am I not getting an answer?
 
Upvote 0
Why am I not getting an answer?
You only need to ask once.

Try this.
Select cell C2
Press F2
Press Ctrl+Shift+Enter together. Excel will enclose the formula with { }
Copy the formula down again
 
Upvote 0
Glad it worked for you.

For the future, you need to be much clearer in telling us what you have and what you are trying to do. We cannot read your mind and we know nothing about what you have or what you are trying to do other than what you tell us and/or show us. You also need to be patient - remember that you are getting help for free. ;)
 
Upvote 0
Glad it worked for you.

For the future, you need to be much clearer in telling us what you have and what you are trying to do. We cannot read your mind and we know nothing about what you have or what you are trying to do other than what you tell us and/or show us. You also need to be patient - remember that you are getting help for free. ;)
I am very grateful to you for taking the time to solve my problem.
I hope you will forgive me for rushing this and also for my poor English.
🙏🙏🙏🙏🙏
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,736
Members
453,369
Latest member
juliewar

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