OFFSET fx Nuances, especially when used w/ Aggregate/Subtotal

Voski

New Member
Joined
Jul 26, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Sorry for the messy presentation here but I wanted to show the formulas as well. Trying to calculate total revenue (using sumproduct) based on various price sets for different products. Need this to stay dynamic and also account for filtered/hidden data. INDEX and XLOOKUP bring in the contents of the variable column but only work with AGGREGATE when rows are hidden. I like offset because the relative reference changes as copied over but will only spill when nested in SUBTOTAL (for some reason it does not sum like INDEX and XLK). This one doesn't work with AGGREGATE. I've reached my time limit on this. Any words of advice or added wisdom?

Quantity A​
Price A​
OFFSET​
INDEX​
XLOOKUP​
1​
10​
#VALUE!​
10​
10​
2​
20​
#VALUE!​
20​
20​
4​
40​
#VALUE!​
40​
40​
5​
50​
#VALUE!​
50​
50​
=OFFSET(C27,SEQUENCE(COUNT(C27:C31),1,0),,)​
=INDEX(A27:C31,,XMATCH(C26,A26:C26))​
=XLOOKUP(C26,A26:C26,A27:C31)​
=AGGREGATE(9,5,OFFSET(C27,SEQUENCE(COUNT(C27:C31),1,0),,))​
#VALUE!​
10​
150​
150
20​
120 120
30​
=SUBTOTAL(9,INDEX(A27:C31,,XMATCH(C26,A26:C26)))​
=SUBTOTAL(9,XLOOKUP(C26,A26:C26,A27:C31))​
40​
=AGGREGATE(9,5,INDEX(A27:C31,,XMATCH(C26,A26:C26)))​
=AGGREGATE(9,5,XLOOKUP(C26,A26:C26,A27:C31))​
50​
=SUBTOTAL(9,OFFSET(C27,SEQUENCE(COUNT(C27:C31),1,0),,))​
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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