Spill Array Formula to Values between Cells on Separate Rows

ScottTemple

Board Regular
Joined
Dec 28, 2023
Messages
103
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a spill array that encompasses columns A - AD with the following formula: =CHOOSECOLS(FILTER(Table9,Table9[Date]<>""),1,2,3...

I would like to calculate the difference between two times that are located on separate rows from each other (see below). The formula I would use in a non spill array is =IF(N3>=O2,N3-O2,N3+1-2)*1440, but that will not work in this instance. Any assistance would be greatly appreciated.

1707244581546.png
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I do something like this - I'll roll one column down one row and put some junk in the front. I don't know if this will be useful for you.

MrExcelPlayground20.xlsx
ABCDEF
1StartFinishStartFinishLag
29:30 PM1:00 AM9:30:00 PM1:00:00 AM 
31:15 AM4:10 AM1:15:00 AM4:10:00 AM15
44:45 AM6:00 AM4:45:00 AM6:00:00 AM35
Sheet28
Cell Formulas
RangeFormula
D2:E4D2=CHOOSECOLS(A2:B4,1,2)
F2:F4F2=LET(a,CHOOSECOLS(D2#,1),b,CHOOSECOLS(D2#,2),c,DROP(VSTACK("a",b),-1),d,IF(c="a","",a-c),IFERROR(d*1440,""))
Dynamic array formulas.
 
Upvote 0
Hey James,

I was out of the office for a couple of week and didn't get a chance to reply back to you until today.

The formula for D2 returns a #SPILL! error; here's an example of my formula: =CHOOSECOLS(N:O,1,2).
 
Upvote 0
N:O is taking the whole columns. When you try to put that starting in row 2, it all just can't fit. If you can make the range smaller, or move the formula up to row 1.
 
Upvote 0
Never mind, I see what you're doing here, but I'm a bit confused on the code. A/B are N/O in my sheet and D2/E2/F2 are BE/BF/BG. How does that translate in the formula you provided for F2?

1708458121697.png
 
Upvote 0
What I was doing in D and E, was to simplify what you had with "=CHOOSECOLS(FILTER(Table9,Table9[Date]<>""),1,2,3.." Basically just a clean array of start and finish values. Then my F column is where I sort that into the Lags between the current rows 'end' and the next rows 'begin'.
 
Upvote 0
Sorry, bit confused by what you mean. Are you suggesting to create a second CHOOSECOLS spill array to include just the Start and FInish times and then use the formula in F2 to create lag times?
 
Upvote 0
No. I just did that to simulate some other calculation that you had shown to get the set of data you were interested in from some larger set that you had that you didn't post. If that isn't true, just replace the "a" and "b" in the let to directly take the data of interest.
 
Upvote 0
Sorry still very confused by what you mean. If I already have the times listed in the original spill array, why would I need to create a second array to calculate from?
 
Upvote 0
Maybe we can start over again. Post some of your data. I can give one formula to sort it out.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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