Help with formula

Copper Contributor

I am looking for help in designing a formula to work out how much product has been produced at a certain time,

 

my factory produces (x) units of product (A) between (timeA) and (timeB),

and (x) units of product (B) between (timeB) and (timeC), 

 

the user will enter what the factory is producing during a certain time period,

e.g.

 

(6:00AM) - (8:42AM) - product (A)

(8:42AM) - (12:40PM) - product (B)

(12:40PM) - (5:34PM) - product (A)

(5:34PM) - (10:20PM) - downtime (0)

(10:20PM) - (4:35AM) next day - product (B)

(4:25AM) - (10:30AM) - product (A)

and so on,

 

how do i get excel to tell me how much product we have produced at a certain time?

 

eg user puts in (2:00PM) and excel works out how much of both product (A) and product (B) and how much downtime (0) there was in that period?

 

1 Reply

@Jonsen625 

 

The formula below will return both the product name and quantity produced if the time entered in A1 is between Time A & Time B.  Note this comes with the assumption that if time B is < time A then it must be the next day and is handled by this portion of the formula:

(A1<=IF(B3:B8<A3:A8,B3:B8+1,B3:B8)).  

 

I'm not sure if this is what you are after, but hope it gets you started.  

 

=FILTER(C3:D8,(A1>=A3:A8)*(A1<=IF(B3:B8<A3:A8,B3:B8+1,B3:B8)))

 

 

DexterG_III_0-1663692400873.png

 

Here's the formula in action: 

 

2022-09-20_09-52-20.gif