Formula Question (If? Offset?)

Gliffix101

Board Regular
Joined
Apr 1, 2014
Messages
81
Hello Forum,

Coming to you for some help in building out a formula. I have a vague idea of what I need it to do, but just can't seem to get the final touches on.

I have attached a copy of the sample below. I need to calculate the time "Status Name Date" between an End (v_End) and a Beginning (v_Start). The problem is that there are, at times, cases where an item (Status Name) does not have a start. I need a formula that will go to a "Yes" in v_End, and then look backwards (Up) until it finds the Start (v_Start) and then calculate the difference between the two. The formula should error out if it comes across another End OR no start.

Here is the formula I started using, but this only does an offset of -1. There are cases where the offset may need to be -2 or greater. I also have cases such as the first Don't Hide (Row 4) that has no beginning, so I would need it to reflect #N/A. The ideal example is that

Code:
=IF(I6="Yes",DAYS(F6,OFFSET(K6,-1,-5,1)) & " Days",0)

Some examples that should work:

1) I4 (v_End) would look back and see there is no start, returning "N/A" in a new column (Column K)
2) I6 (v_End) would look back and see a start in H5 (v_Start) and would determine the difference in dates between (F6 vs. F5)
3) I10 (v_End) would look back and see a start in H8 (v_Start) and would determine the difference in dates between (F10 vs. F8)
4) I14 (v_End) would look back and see a start in H12 (v_Start) and would determine the difference in dates between (F14 vs. F12)
5) I16 (v_End) would look back and see an end (I14) before a start (H12) and would return (N/A)
6) I22 (v_End) would look back and see an end (I20) before a start (H19) and would return (N/A)

ABCDEFGHIJ
1Acct #TypeStatus NameStatus Name HistoryStatus Name UserStatus Name Datev_Userv_Startv_Endv_Hide
2-FDHazOutstandingWeb User8/6/2015N/ANoNoHide
3-FDHazRequestedWeb User 211/17/2016CompANoNoHide
4-FDHazReceivedWeb User 211/17/2016CompANoYesDon't Hide
5-SLHazOutstandingWeb User1/28/2016N/AYesNoDon't Hide
6-SLHazProblemWeb User 211/2/2016CompBNoYesDon't Hide
7-FDRequest45TOutstandingWeb User4/13/2016N/ANoNoHide
8-FDRequest45TInitiatedWeb User 210/28/2016N/AYesNoDon't Hide
9-FDRequest45TRequestedWeb User 211/2/2016CompANoNoHide
10-FDRequest45TCompletedWeb User 211/9/2016CompANoYesDon't Hide
11-FDHazOutstandingWeb User4/13/2016N/ANoNoHide
12-FDHazInitiatedWeb User 211/11/2016N/AYesNoDon't Hide
13-FDHazRequestedWeb User 211/14/2016CompANoNoHide
14-FDHazReceivedWeb User 211/16/2016CompANoYesDon't Hide
15-SLInitVVOutstandingWeb User4/22/2016N/ANoNoHide
16-SLInitVVCompletedWeb User 211/21/2016CompANoYesDon't Hide
17-SLInitVVOutstandingWeb User5/3/2016N/ANoNoHide
18-SLInitVVNot ApplicableWeb User 25/16/2016N/ANoNoHide
19-SLInitVVInitiatedWeb User 26/20/2016N/AYesNoDon't Hide
20-SLInitVVCompletedWeb User 26/21/2016CompANoYesDon't Hide
21-SLInitVVRequestedWeb User 26/21/2016CompANoNoHide
22-SLInitVVCompletedWeb User 26/21/2016CompANoYesDon't Hide
23-SLInitVVInitiatedWeb User 26/28/2016N/AYesNoDon't Hide
24-SLInitVVCompletedWeb User 26/28/2016CompANoYesDon't Hide
25-SLInitVVExpiredWeb User 28/18/2016N/ANoNoHide
26-SLInitVVInitiatedWeb User 28/18/2016N/AYesNoDon't Hide
27-SLInitVVRequestedWeb User 28/23/2016CompANoNoHide
28-SLInitVVCompletedWeb User 28/23/2016CompANoYesDon't Hide
29-SLInitVVReturnedWeb User 29/12/2016N/ANoNoHide
30-SLInitVVInitiatedWeb User 29/14/2016N/AYesNoDon't Hide
31-SLInitVVRequestedWeb User 29/15/2016CompANoNoHide
32-SLInitVVCompletedWeb User 29/28/2016CompANoYesDon't Hide
33-SLInitVVInitiatedWeb User 211/11/2016N/AYesNoDon't Hide
34-SLInitVVRequestedWeb User 211/14/2016CompANoNoHide
35-SLInitVVCompletedWeb User 211/14/2016CompANoYesDon't Hide
36-FDInitVVOutstandingWeb User5/4/2016N/ANoNoHide
37-FDInitVVInitiatedWeb User 25/23/2016N/AYesNoDon't Hide
38-FDInitVVRequestedWeb User 25/24/2016CompANoNoHide
39-FDInitVVCompletedWeb User 25/24/2016CompANoYesDon't Hide
40-FDInitVVInitiatedWeb User 29/15/2016N/AYesNoDon't Hide
41-FDInitVVRequestedWeb User 29/19/2016CompANoNoHide
42-FDInitVVCompletedWeb User 29/20/2016CompANoYesDon't Hide
43-FDInitVVInitiatedWeb User 211/2/2016N/AYesNoDon't Hide
44-FDInitVVRequestedWeb User 211/3/2016CompANoNoHide
45-FDInitVVCompletedWeb User 211/7/2016CompANoYesDon't Hide

<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>

Please ask any questions you may have. I looked through and did not see a way to add an attachment to post my sample document.

Thanks,

Bill
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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