Averageif using Index Match

nathanthomson

New Member
Joined
Aug 29, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
In the attached excel snippet, I show sales from 2022 & 2023. I'm looking to pull the average sales during the golf season (May - September) and average sales in the off season for 2022 & 2023 combined. For example, in the table cell B13 "Golf Season - Alcohol Sales", I would want to see the average of F3 - J3 & R3 - V3 ($6,000). I'm working on a large document so ideally find a formula that references both column header and row header so I can drag it.

I apologize, I am on my work network and am unable to download XL2BB.
 

Attachments

  • Example.JPG
    Example.JPG
    128.3 KB · Views: 10

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hello, please test this:

Excel Formula:
=LET(
months,B2:Y2,
sales,B3:Y5,
list,TEXT(SEQUENCE(,12)*28,"mmmm"),
seq,SEQUENCE(,12),
numbers,XLOOKUP(months,list,seq),
season,(numbers>=5)*(numbers<=9),
HSTACK(BYROW(FILTER(sales,season=1),LAMBDA(a,AVERAGE(a))),BYROW(FILTER(B3:Y5,season=0),LAMBDA(a,AVERAGE(a)))))
 
Upvote 1
Solution
Hello, please test this:

Excel Formula:
=LET(
months,B2:Y2,
sales,B3:Y5,
list,TEXT(SEQUENCE(,12)*28,"mmmm"),
seq,SEQUENCE(,12),
numbers,XLOOKUP(months,list,seq),
season,(numbers>=5)*(numbers<=9),
HSTACK(BYROW(FILTER(sales,season=1),LAMBDA(a,AVERAGE(a))),BYROW(FILTER(B3:Y5,season=0),LAMBDA(a,AVERAGE(a)))))
That appears to have worked. Thank you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
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