Calculating sequential dates from random columns

1710

New Member
Joined
Feb 15, 2012
Messages
2
I have a table of orders that include multiple transaction dates which indicate which step of the order process was completed on what date. The sequence in which these steps are completed varies from transaction to transaction. With the exception of the creation date, each date is the date that step was completed.

I'm trying to automate the calculation of how many days a given step took. In row 2, the calculation would be fairly straightforward as the "steps" all took place in the same order as their column arrangement. A formula could be written (and was) that calculates the number of days between 2 column unless it's neighbour is blank. Works perfectly as long as the order follows the column arrangements.

If the dates don't flow, as in rows 5 and 6 for example, then the answer to the days calculation is meaningless.

I'm thinking that each row needs to be sorted and calculated without losing track of it's label. I have zero VBA foo and haven't been able to formula my way to a solution yet.
Rich (BB code):
Excel Workbook
ABCDEFGHIJK
1Work OrderCustomerOrder Open1st InspectionQuoteWaiting for POWaiting for PartsRepairWith VendorCODShipped
228004Jim17/01/1206/02/1209/02/1213/02/1213/02/1213/02/12na13/02/1213/02/12
329486Joe18/01/1225/01/1225/01/1225/01/1225/01/1210/02/12na10/02/1210/02/12
431496Bob04/07/1112/10/1105/10/1105/10/1105/10/1123/01/12na
532269Ryan12/01/1230/01/1213/02/1231/01/1231/01/1210/02/12
633606Frank05/12/1120/12/1120/12/1120/12/1120/12/1122/01/1220/01/12
730039Peter09/02/1210/02/1214/02/1214/02/1212/02/12na
827753Albert30/01/1207/02/1208/02/1207/02/12na
931262Dave17/06/1120/09/1122/07/1122/07/1122/07/1114/02/12na
1032804Adam21/09/1123/11/11nanana09/02/12na
1112161Chris26/09/1128/09/1110/01/1228/09/1110/01/1219/01/12na
1220841Craig04/10/1111/10/1111/10/1111/10/1113/10/1118/01/12na
1385016John19/10/1118/11/1119/10/1119/10/1119/10/1110/02/12na
1454116Tom06/12/1114/12/1114/12/1114/12/1114/12/1124/01/12na
Sheet1
Excel 2010
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Actually I seem to have created a workable formula:
Code:
=IF(MIN(IFERROR(IF(D2-$C2>0,D2-$C2,1000),1000),IFERROR(IF(D2-$D2>0,D2-$D2,1000),1000),IFERROR(IF(D2-$E2>0,D2-$E2,1000),1000),IFERROR(IF(D2-$F2>0,D2-$F2,1000),1000),IFERROR(IF(D2-$G2>0,D2-$G2,1000),1000),IFERROR(IF(D2-$H2>0,D2-$H2,1000),1000),IFERROR(IF(D2-$I2>0,D2-$I2,1000),1000),IFERROR(IF(D2-$J2>0,D2-$J2,1000),1000),IFERROR(IF(D2-$K2>0,D2-$K2,1000),1000))<>1000,MIN(IFERROR(IF(D2-$C2>0,D2-$C2,1000),1000),IFERROR(IF(D2-$D2>0,D2-$D2,1000),1000),IFERROR(IF(D2-$E2>0,D2-$E2,1000),1000),IFERROR(IF(D2-$F2>0,D2-$F2,1000),1000),IFERROR(IF(D2-$G2>0,D2-$G2,1000),1000),IFERROR(IF(D2-$H2>0,D2-$H2,1000),1000),IFERROR(IF(D2-$I2>0,D2-$I2,1000),1000),IFERROR(IF(D2-$J2>0,D2-$J2,1000),1000),IFERROR(IF(D2-$K2>0,D2-$K2,1000),1000)),"")
No...no I haven't. That doesn't work either. :(
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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