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
 
I have two tabs in one workbook. The first tab contains my data entry sheet (Table9), the second tab contains my spill array with the below formula (columns A - AD). Outside of that spill array, I have various formulas to calculate data (columns AE - BD) that pull from that spill array. In column BE, I would like to create a formula that calculates the difference between a Finish Time (cell O2) and the Start Time (Cell N3), O & N are contained within the spill array. Unfortunately, my company restricts what we plug-ins we can add to our computers, so I'm unable to provide the data sheet using XL2BB.

=CHOOSECOLS(FILTER(Table9,Table9[Date]<>""),1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30)

1708613861832.png
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
This should do the trick.

MrExcelPlayground20.xlsx
ANOADBE
1DateStartFinishADGap
22/21/20249:30:00 PM1:00:00 AMA 
32/22/20241:15:00 AM4:10:00 AMB15
42/22/20244:45:00 AM6:00:00 AMD35
Sheet30
Cell Formulas
RangeFormula
A2:AD4A2=CHOOSECOLS(FILTER(Table9,Table9[Date]<>""),SEQUENCE(30))
BE2:BE4BE2=LET(a,CHOOSECOLS(A2#,14),b,CHOOSECOLS(A2#,15),c,DROP(VSTACK("a",b),-1),d,IF(c="a","",a-c),IFERROR(d*1440,""))
Dynamic array formulas.
 
Upvote 0
Oh you mad lad, that did the trick! However, my initial formula was slighlty incorrect and I'm not certain how to read your formula. The time formula should read:

=IF(N3>=O2,N3-O2,N3+1-O2)*1440

Instead of

=IF(N3>=O2,N3-O2,N3+1-2)*1440
 
Upvote 0
Ah, the day rollover... Try this:

Excel Formula:
=LET(a,CHOOSECOLS(A2#,14),b,CHOOSECOLS(A2#,15),c,DROP(VSTACK("a",b),-1),d,IF(c="a","",IF(a-c>0,a-c,1+a-c)),IFERROR(d*1440,""))
 
Upvote 1
Perfect, thank you! How do you learn stuff like this? I'm good with some formulas, but I don't even know where to find training on this level of Excel.
 
Upvote 0
This is the training. I solve problems I find here. I was pretty skilled with excel on Jan 12, 2021. But when I joined this site the next day, it started really taking off. I more than doubled my usefulness. Plus 365 is a wonderful imporovement.
 
Upvote 0
Ah gotcha. Another quick question for you, if the data I'm pulling from tab1 is blank, specifically time/date cells, how can we have the spill array return a blank value? Currently, if I'm missing a date or time, it returns a 12:00am or 1/0/1900 value, which will mess with my pivot data later on.
 
Upvote 0
You current filter looks for "Date" being blank. You can also filter for time being blank.

So when you filter:
FILTER(Table9,Table9[Date]<>"")

you can add more to it, like
FILTER(Table9,(Table9[Date]<>"")*(Table9[Start Time]<>"")*(Table9[End Time]<>""))

the will filter out more unwanted data.
 
Upvote 0
I updated the formula, but I'm getting an error. Would you mind taking a look? I changed Table9 to Shaver_Data

=CHOOSECOLS(FILTER(Shaver_Data,(Shaver_Data[Date]<>"")*(Shaver_Data,(Shaver_Data[Start Time]<>"")*(Shaver_Data,(Shaver_Data[Finish Time]<>"")*(Shaver_Data,(Shaver_Data[Insp Start Date]<>"")
*(Shaver_Data,(Shaver_Data[Insp Complete Date]<>"")),SEQUENCE(30))
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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