lookup functions errors

rcocrane99

New Member
Joined
May 9, 2024
Messages
35
Office Version
  1. 365
Platform
  1. Windows
Hello everyone, I've been stuck working on some data these last few days and I need to find a way to extract 2 pieces of data per "production day". My company currently operates from about 7 am to 1 am and I need to get a precise "Start" and "Shutdown" time (see row 5 and 6) to then get a "run time". The sample set continues and we will just keep adding as we go so I need something that will kind of just update on another sheet over time.
1715644435537.png

I've tried, nested xlookups, minifs and maxifs and index match but I couldn't really understand it so if anyone has a creative solution have a wack at it.
Would like to have all of the data here eventually:
1715644575247.png
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Here's one way. Since you're using 365 there's no doubt a more compact formula available.

Book1
CUCVCWCXCYCZDADBDCDDDEDFDGDHDIDJ
5StartShutdownRuntimeStartShutdownStart
61/05/20241/05/2024 7:30 1/05/2024 7:302/05/2024 0:152/05/2024 8:40
72/05/20242/05/2024 8:402/05/2024 0:1516:45
83/05/2024  
94/05/2024  
105/05/2024  
116/05/2024  
127/05/2024  
138/05/2024  
149/05/2024  
1510/05/2024  
1611/05/2024  
Sheet1
Cell Formulas
RangeFormula
CV6:CW16CV6=IF(SUMPRODUCT(($CZ$5:$DL$5=CV$5)*(DATE(YEAR($CZ$6:$DL$6),MONTH($CZ$6:$DL$6),DAY($CZ$6:$DL$6))=$CU6)*$CZ$6:$DL$6)=0,"",SUMPRODUCT(($CZ$5:$DL$5=CV$5)*(DATE(YEAR($CZ$6:$DL$6),MONTH($CZ$6:$DL$6),DAY($CZ$6:$DL$6))=$CU6)*$CZ$6:$DL$6))
CX7CX7=CW7-CV6
 
Upvote 0
Here's one way. Since you're using 365 there's no doubt a more compact formula available.

Book1
CUCVCWCXCYCZDADBDCDDDEDFDGDHDIDJ
5StartShutdownRuntimeStartShutdownStart
61/05/20241/05/2024 7:30 1/05/2024 7:302/05/2024 0:152/05/2024 8:40
72/05/20242/05/2024 8:402/05/2024 0:1516:45
83/05/2024  
94/05/2024  
105/05/2024  
116/05/2024  
127/05/2024  
138/05/2024  
149/05/2024  
1510/05/2024  
1611/05/2024  
Sheet1
Cell Formulas
RangeFormula
CV6:CW16CV6=IF(SUMPRODUCT(($CZ$5:$DL$5=CV$5)*(DATE(YEAR($CZ$6:$DL$6),MONTH($CZ$6:$DL$6),DAY($CZ$6:$DL$6))=$CU6)*$CZ$6:$DL$6)=0,"",SUMPRODUCT(($CZ$5:$DL$5=CV$5)*(DATE(YEAR($CZ$6:$DL$6),MONTH($CZ$6:$DL$6),DAY($CZ$6:$DL$6))=$CU6)*$CZ$6:$DL$6))
CX7CX7=CW7-CV6
close! the reason I think I am struggling so much is the time goes past midnight therefore changing the day, so for example inCW7 the result you have should actually be in CW6
 
Upvote 0
Perhaps.
Book1
CUCVCWCXCYCZDADBDCDDDEDFDGDHDIDJ
5StartShutdownRuntimeStartShutdownStart
65/1/245/1/24 7:305/2/24 0:1516:45:005/1/24 7:305/2/24 0:155/2/24 8:40
75/2/245/2/24 8:40
85/3/24
95/4/24
105/5/24
115/6/24
125/7/24
135/8/24
145/9/24
155/10/24
165/11/24
Sheet1
Cell Formulas
RangeFormula
CW6CW6=MINIFS(CZ6:DJ6,CZ6:DJ6,">"&CV6)
CX6CX6=CW6-CV6
CV6:CV7CV6=XLOOKUP(1,(INT($CU6)=INT($CZ$6:$DJ$6))*($CZ$5:$DJ$5=CV$5),$CZ$6:$DJ$6)
 
Last edited:
Upvote 0
This looks right given the sheet you have provided, I'll take a look tomorrow morning when I get to work! Just to clarify what is the CZ6 cell for and how does the CZ6:DJ6 and CZ5:DJ6 affect the equation? Sorry still an Excel newbie
 
Upvote 0
just seeing the scroll bar now lol, do you know if these work across different sheets or does all of the data need to be on one?
 
Upvote 0
It should work across sheets. It might be easier to get the formula right on the same sheet and cut that cell into your desired sheet.
 
Upvote 0
Are the date cells date type and not string?
You can check by =ISNUMBER(). If true then it's a date, else it's a string. If it's string you need to convert it to date type.
 
Upvote 0
1715718157057.png

looks like its almost there, cell formulas to the right not sure why it doesn't fill down with the other cells
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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