Excel formula / vba to calculate the Time Taken according to batches of data

oHoi99

New Member
Joined
Dec 20, 2020
Messages
23
Office Version
  1. 2019
Platform
  1. Windows
Good day. I am facing an issue where I do not know to write the formula to calculate the time taken in Column I. I want to calculate the time taken for each batch of cakes baked.

Different batches of cakes can be distinguished by the uniqueID (column K).

I also prepared column J (Last in Batch) to indicate which row of data is the last data for that particular batch of cake. For example, there is a "1" in cell K23, it means that from row 2 to row 23 are the data recorded for the batch NJ029-1. Then all the data from row 24 till row 39 is for NJ029-2, and so on until the end.

To calculate the time taken for one batch of cake, I would have the take the EndTime (column L), and subtract it with the StartTime (column F) of one single batch of data. For instance, I23=(K23-F2)*60. *60 is to make it in minutes.

I have an idea in mind, but it does not seem to work... I calculate it by referring the column J (Last in Batch)...
=IF(J2=1, (L2-INDEX(F:F, MATCH(1, INDEX(J:J, ROW(J2)):INDEX(J:J, ROW(J2)+1), 0)))*60, "")

Could anyone give me some ideas, please?:cry:



Please refer to the table below:
1694930852766.png


Note: You may ignore column C.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
One idea is to take columns L minus F for each row, and then use the Pivot table to sum the time difference for each unique batch.

I don't have an answer using formula only.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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