Array Formula

Frankroger

New Member
Joined
Nov 16, 2023
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
I'm trying to figure out an array formula for this problem.

The two yellow cells are my inputs, F2 and G2

G6 is the answer cell that I need to create an array formula for

I've entered the date 15/01/2000 into "F2"
and the unit number 10 into "G2"

I want to return into cell "G6"
the date that is closest to 10 units from my specified start date, using columns "A" and "B" to figure from.

Column D is just an example,
I'm summing the cells in column "B" that are greater than the 15/01/2000, then ive highlighted in red the date that was closest to 10 units, so cell "G6" should return the date 21/01/2000

If I entered 17 into "G2", then "G6" should return 25/01/2000

But I want to figure this date via a single array formula rather using thousands of figuring helper cells

Any assistance would be greatly appreciated! Thank you

Edit: I didn't enter the title to my thread properly when I posted, but it won't allow me to edit to make the title more specific to my question




Book1
ABCDEFGHIJKLMNOPQR
1DateUnitStart DateUnit
210/01/20001.115/01/200010
311/01/20001.3
412/01/20001.6
513/01/20001.4Anwser
614/01/20001.521/01/2000[0]0[/FORMULA]
715/01/20001.41.4
816/01/20001.73.1
917/01/20001.84.9
1018/01/20001.26.1
1119/01/20001.57.6
1220/01/20001.38.9
1321/01/20001.710.6
1422/01/20001.812.4
1523/01/20001.513.9
1624/01/20001.915.8
1725/01/20001.217
1826/01/20001.118.1
1927/01/20001.819.9
2028/01/20001.921.8
2129/01/20001.223
2230/01/20001.624.6
2331/01/20001.325.9
2401/02/20001.227.1
2502/02/20001.628.7
2603/02/20001.830.5
27
28
29
Sheet3
Cell Formulas
RangeFormula
I6I6
A3:A26A3=A2+1
D7:D26D7=SUM(B$7:$C7)
 
Last edited:

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.
Are you still using XL2013?
Yes, unfortunately =(

I've created another minisheet with an updated breakdown of the figuring by using helper cells.
Just to provide clarity of what I was hoping an array formula could solve without the helper cells

Cell Formulas
RangeFormula
H10:H25H10=SUM($I$10:I10)
I10:I25I10=INDEX(B2:B26,MATCH(J10,A2:A26,0))
J10J10=F2
A3:A26,J11:J25J11=J10+1
L10L10=VLOOKUP(G2,H10:J25,3,TRUE)
D7:D26D7=SUM(B$7:$C7)
 
Upvote 0
Microsoft no longer supports XL2013 so you're at risk. Anyhow, try this with one helper column. I don't have 2013 to test. (Note: date format in the US).
Cell Formulas
RangeFormula
G6G6=INDEX($A$2:$A$26,MATCH(TRUE,$C$2:$C$26>=G2,0))
A3:A26A3=A2+1
C2:C26C2=SUM(IF(A2>=$F$2,B2,0),C1)
 
Upvote 1
Another option, don't use the helper column:

Cell Formulas
RangeFormula
F6F6=LOOKUP(G2,SUMIFS($B$2:$B$26,$A$2:$A$26,">="&F2,$A$2:$A$26,"<="&$A$2:$A$26),$A$2:$A$26)
A3:A26A3=A2+1
D7:D26D7=SUM(B$7:$C7)
 
Upvote 1
Solution
5th
Another option, don't use the helper column:

Cell Formulas
RangeFormula
F6F6=LOOKUP(G2,SUMIFS($B$2:$B$26,$A$2:$A$26,">="&F2,$A$2:$A$26,"<="&$A$2:$A$26),$A$2:$A$26)
A3:A26A3=A2+1
D7:D26D7=SUM(B$7:$C7)
Another option, don't use the helper column:

Cell Formulas
RangeFormula
F6F6=LOOKUP(G2,SUMIFS($B$2:$B$26,$A$2:$A$26,">="&F2,$A$2:$A$26,"<="&$A$2:$A$26),$A$2:$A$26)
A3:A26A3=A2+1
D7:D26D7=SUM(B$7:$C7)

Thank you!

It works, but it unfortunately freezes excel in calculation when using ranges of 25000 cells, that I'm waiting a few minutes for it to unfreeze.

It's interesting how the helper column method, which adds an extra 25000 cells of individual calculations to be made,
is more efficent at getting the answer from a large dataset than via the single formula method and doesn't freeze in the process

Is one big number crunch within a single cell more intensive on the cpu than a problem being divided out amongst many helper cells?
 
Upvote 0
If the data is large, you can use a helper column:

Book1
ABCDEFGH
1DateUnitHelperStart DateUnitAnwser
210/1/20001.11.111/1/20001922/1/2000
311/1/20001.32.415/1/20001221/1/2000
412/1/20001.6418/1/20001527/1/2000
513/1/20001.45.4
614/1/20001.56.9
715/1/20001.48.3
816/1/20001.710
917/1/20001.811.8
1018/1/20001.213
1119/1/20001.514.5
1220/1/20001.315.8
1321/1/20001.717.5
1422/1/20001.819.3
1523/1/20001.520.8
1624/1/20001.922.7
1725/1/20001.223.9
1826/1/20001.125
1927/1/20001.826.8
2028/1/20001.928.7
2129/1/20001.229.9
2230/1/20001.631.5
2331/1/20001.332.8
241/2/20001.234
252/2/20001.635.6
263/2/20001.837.4
Sheet1
Cell Formulas
RangeFormula
H2:H4H2=INDEX($A$2:$A$26,MATCH(G2+VLOOKUP(F2-1,$A$2:$C$26,3,1),$C$2:$C$26,1))
C2:C26C2=SUM(B2,C1)
 
Upvote 0
@Phuoc
For 11/1/2000 & 19 units, I'd expect 23/1/2000 (19.7). Where 22/1/2000 is only 18.2
Similar issue for the next row.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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