Dynamic range addresses, references, and calculations

squigman

New Member
Joined
Mar 17, 2025
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Good day everyone! This is my first time posting, hopefully I am doing it correctly (let me know if not)...

I have searched to try and find help on variable/dynamic range selection and then referencing on those range addresses, but I couldn't adapt what I found to my needs.

Below, in the orange cells I am trying to answer questions posed in the purple cells about the table in the blue cells. Unfortunately, I couldn't figure out the formula to answer any of those questions.

Big thanks in advance for any help you can give!


Formula Testing.xlsx
ABCDEFGHIJKLMNOP
1Starting Quaifying Value
21000
3
4Ending Qualify Value
52000
6
7Date range
8Date when first passing qualifying valueDate right before first passing the Ending Qualifying ValueDate Range Adress of the prior two valuesSum of the cells in the Address in D10Date2023 Q12023 Q22023 Q32023 Q42024 Q12024 Q22024 Q32024 Q42025 Q1
9Category A4568559431031980120788014002100
10Correct Output to be returned in the Orange cells above2023 Q42024 Q4K9:O95498
Sheet1
 
Hello, please test how this might work:

Excel Formula:
=LET(
s,G2,
e,G5,
c,H9:P9,
d,H8:P8,
v_1,INDEX(d,0,XMATCH(TRUE,c>s)),
v_2,INDEX(c,0,XMATCH(TRUE,c>e)-1),
v_3,ADDRESS(ROW(c),COLUMN(v_1),4)&":"&ADDRESS(ROW(c),COLUMN(v_2),4),
v_4,SUM(v_1:v_2),
HSTACK(v_1,v_2,v_3,v_4))
 
Upvote 0
Hello, please test how this might work:

Excel Formula:
=LET(
s,G2,
e,G5,
c,H9:P9,
d,H8:P8,
v_1,INDEX(d,0,XMATCH(TRUE,c>s)),
v_2,INDEX(c,0,XMATCH(TRUE,c>e)-1),
v_3,ADDRESS(ROW(c),COLUMN(v_1),4)&":"&ADDRESS(ROW(c),COLUMN(v_2),4),
v_4,SUM(v_1:v_2),
HSTACK(v_1,v_2,v_3,v_4))

Wow! Thank you Hagia! This gets me to my final answer and shows me some great LET structure that I had not thought about, but I dont quite understand the v_2 term. It returns 1400 instead of the "2024 Q4" I was expecting. I made an adjustment in your formula to return the "2024 Q4", but that then returned an incorrect value of 0 for V_4 instead of 5498.

Would you be able to explain why your v_4 or SUM(v_1:v_2) which I think substitutes to SUM("2023 Q4":1400) worked to get 5498. I would have guessed that would have produced an error, as those dont seem like a range to SUM and dont to be similar references at all. I am missing something basic but critical.

Thanks again!


Formula Testing.xlsx
ABCDEFGHIJKLMNOP
1Starting Quaifying Value
21000
3
4Ending Qualify Value
52000
6
7Date range
8Column1Date when first passing qualifying valueDate right before first passing the Ending Qualifying ValueDate Range Adress of the prior two valuesSum of the cells in the Address in D10Date2023 Q12023 Q22023 Q32023 Q42024 Q12024 Q22024 Q32024 Q42025 Q1
9Category A4568559431031980120788014002100
10Correct Output to be returned in the Orange cells above2023 Q42024 Q4K9:O95498
11
12
13per suggested formula2023 Q41400K9:O95498
14
15my second attempt2023 Q42024 Q4K9:O90
Sheet1 (3)
Cell Formulas
RangeFormula
B13:E13B13=LET( s,G2, e,G5, c,H9:P9, d,H8:P8, v_1,INDEX(d,0,XMATCH(TRUE,c>s)), v_2,INDEX(c,0,XMATCH(TRUE,c>e)-1), v_3,ADDRESS(ROW(c),COLUMN(v_1),4)&":"&ADDRESS(ROW(c),COLUMN(v_2),4), v_4,SUM(v_1:v_2), HSTACK(v_1,v_2,v_3,v_4))
B15:E15B15=LET( s,G2, e,G5, c,H9:P9, d,H8:P8, v_1,INDEX(d,0,XMATCH(TRUE,c>s)), v_2,INDEX(d,0,XMATCH(TRUE,c>e)-1), v_3,ADDRESS(ROW(c),COLUMN(v_1),4)&":"&ADDRESS(ROW(c),COLUMN(v_2),4), v_4,SUM(v_1:v_2), HSTACK(v_1,v_2,v_3,v_4))
Dynamic array formulas.
 
Upvote 0
Hello, many thanks for your feedback I definitely "outwitted" myself and have to apologize. It should be something like:

Excel Formula:
=LET(
s,G2,
e,G5,
c,H9:P9,
d,H8:P8,
v_1,INDEX(d,0,XMATCH(TRUE,c>s)),
v_2,INDEX(d,0,XMATCH(TRUE,c>e)-1),
v_3,ADDRESS(ROW(c),COLUMN(v_1),4)&":"&ADDRESS(ROW(c),COLUMN(v_2),4),
v_4,SUM(INDEX(c,0,XMATCH(INDEX(v_1:v_2,0,0),d))),
HSTACK(v_1,v_2,v_3,v_4))

As far as why the original v_4 part worked, this is due to that v_1:v_2 returned K8:O9.
 
Upvote 1
Solution
Thank you so much! This has given me additional understandings beyond the question itself.

I came up with a tweak in the v_4 that seems to also work, but I have no doubt your is better form and I will use that.


Excel Formula:
=LET(
s,G2,
e,G5,
c,H9:P9,
d,H8:P8,
v_1,INDEX(d,0,XMATCH(TRUE,c>s)),
v_2,INDEX(d,0,XMATCH(TRUE,c>e)-1),
v_3,ADDRESS(ROW(c),COLUMN(v_1),4)&":"&ADDRESS(ROW(c),COLUMN(v_2),4),
v_4,SUM(XLOOKUP(v_1,d,c):XLOOKUP(v_2,d,c)),
HSTACK(v_1,v_2,v_3,v_4))
 
Upvote 0

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