Average row in array based on selected hour

LambChoptheKid

New Member
Joined
Dec 10, 2022
Messages
35
Office Version
  1. 365
Platform
  1. Windows
Hey everyone,

I am trying to average a row of data in my table here based on the number that I input in cell B2.

For example, as I have entered 17:00 in cell B2, I would like the formula to average the 15 highest values within the row of data corresponding to hour 17:00.

I would appreciate any help or guidance with solving this problem.

Thank you!
Screenshot 2023-12-15 033757.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
For the future, you will generally get faster/better responses if you can provide data that can be used for testing without heaps of manual typing. Have a look at XL2BB

I would like the formula to average the 15 highest values within the row of data corresponding to hour 17:00.
See how this goes.

23 12 15.xlsm
ABCDEFGHIJKLMNOPQRSTU
16:00
2
3705.0666667
4
5
6
71:00934847698546662037260686152984436849796641438190731294330
82:00317819800886521766914512348672352470912575113351749467928140
93:00963163611459799867966228925965158133193493207637618412355454
104:00409700620641598180353182766900824903201417136205635966370178
115:00450689168142916523522121276844510899873165486926259322800
126:0069295683092389685304243723182947336764340996784790824520335
137:005957248394705081889199333174612688219129933315244572347556
148:005592666239067785196426506954162750324151195728496392874440
159:002565083842795319527454079856948751178238608220667478798675
Average
Cell Formulas
RangeFormula
B3B3=AVERAGE(INDEX(SORT(FILTER(B7:U15,A7:A15=B1),,-1,1),SEQUENCE(,15)))
 
Upvote 1
Solution
For the future, you will generally get faster/better responses if you can provide data that can be used for testing without heaps of manual typing. Have a look at XL2BB


See how this goes.

23 12 15.xlsm
ABCDEFGHIJKLMNOPQRSTU
16:00
2
3705.0666667
4
5
6
71:00934847698546662037260686152984436849796641438190731294330
82:00317819800886521766914512348672352470912575113351749467928140
93:00963163611459799867966228925965158133193493207637618412355454
104:00409700620641598180353182766900824903201417136205635966370178
115:00450689168142916523522121276844510899873165486926259322800
126:0069295683092389685304243723182947336764340996784790824520335
137:005957248394705081889199333174612688219129933315244572347556
148:005592666239067785196426506954162750324151195728496392874440
159:002565083842795319527454079856948751178238608220667478798675
Average
Cell Formulas
RangeFormula
B3B3=AVERAGE(INDEX(SORT(FILTER(B7:U15,A7:A15=B1),,-1,1),SEQUENCE(,15)))
This worked, thank you! Unfortunately I'm not in a position to use non-native addons in my workspace so pictures is the best that I'm currently able to do.

Appreciate the help!
 
Upvote 0
I'm not in a position to use non-native addons in my workspace
So a different 'for the future';
  • State that in your opening post so we don't keep asking, and
  • For smallish samples you can simply copy/paste from Excel into your post and tell us what range it is and explain any formulas involved. At least that way we can copy for testing, which we cannot do easily from an image.
This worked, thank you!
You're welcome. Glad to help. :)
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

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