XLOOKUP & SEQUENCE in Dynamic Array

MrRajKumar

Active Member
Joined
Jan 29, 2008
Messages
291
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

Here is my data layout (A1;D5)

Date # of Months Amount Pay
1/1/2023 12 1,000 100
1/15/2023 18 1,500 150
2/23/2023 6 2,000 500
6/1/2023 24 2,500 250

All these values are filled as dynamic array. In column D, I need to get in which month we will achieve the amount (multiply # of Months (1 to n) with Pay amount).
So currently I used XLOOKUP with SEQUENCE.

=XLOOKUP(C2,SEQUENCE(,B2)*D2,EOMONTH(A2,SEQUENCE(,B2)-1),"",1)

It works fine. But I have drag down until the data set. So how can I use this formula with dynamic array feature, eg: C2#

May be using with MMULT. I don't know. Thank you for your time & assistance.
Raj
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Is each column it's own spill range, or is A2:D5 a single spill range?
 
Upvote 0
Missed that you are using 2021 & so don't have Lambda functions.
I'll need to rethink.
 
Upvote 0
If A1:D5 is from an dynamtic array, then you should just need to add # for each reference.

Excel Formula:
=XLOOKUP(C2#,SEQUENCE(,B2#)*D2#,EOMONTH(A2#,SEQUENCE(,B2#)-1),"",1)

Or did I missunderstand?
 
Upvote 0
That will never work, sequence does work with an array.
 
Upvote 0
How about
Excel Formula:
=LET(x,CEILING(C2#/D2#,1),IF(x>B2#,"",EOMONTH(--A2#,x-1)))
 
Upvote 1
Solution
If A1:D5 is from an dynamtic array, then you should just need to add # for each reference.

Excel Formula:
=XLOOKUP(C2#,SEQUENCE(,B2#)*D2#,EOMONTH(A2#,SEQUENCE(,B2#)-1),"",1)

Or did I missunderstand?
Thank you for your reply MagnarH,

That will not work. In D2 SEQUENCE has to create array of 12 months, but in D3 it is 18, D4 is 6 etc...
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
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