+ Reply to Thread
Results 1 to 7 of 7

Find length of time between latest and last instance formula

  1. #1
    Registered User
    Join Date
    06-05-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    35

    Find length of time between latest and last instance formula

    Hi,

    I have some data containing date columns and a column showing a 1 to represent in stock and a 2 to represent out of stock. I am trying to find a formula that allows me to measure the time in days for a specific item between the occurrence of a 2 (going out of stock) and then the next occurrence of a 1 (when it comes back into stock). The same item may come in and out of stock several times so it must treat each pairing of a 2 and 1 as its own instance. I have filled in the first example in the attached workbook. You will see a tab called pivot also, I thought this might be part way to a solution but I think its a dead end, feel free to disregard.

    Not sure if this is actually possible but would be great to know either way. If anyone can help it will be much appreciated.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find length of time between latest and last instance formula

    For whatever reason, there are several "in stock" lines for each "out of stock" line. So this records a number, at the date on which a line went out of stock, telling you how many days before it came back in again. what you asked for, except beside the 2's not the 1s. Does that make sense???

    In J2, copied down:

    =IFERROR(IF(G2=1,"",LOOKUP(2,1/($I1:$I$2=I2),$E1:$E$2)-E2),"Never replaced")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    06-05-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    35

    Re: Find length of time between latest and last instance formula

    Wow, thank you, that worked perfectly. I have found a second problem though, happy to start a new thread if that is the correct protocol. Now I know the number of days I need to know how many fall into each month. I have added some helper columns in the spreadsheet to do this and started with a array formula but got lost. Is it possible do you think? For instance if it goes out of stock 20th Jan and back in 10th Feb then it would need to say 11 days in the Jan column and 10 in the Feb column.

    Like I say, you have already helped me greatly so more than happy to start a new thread and I am thankful for your input.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find length of time between latest and last instance formula

    Snag 1 was trusting you!! you had the formulae in K & L mixed up. That was OK to fix.. Snag 2: I had it working perfectly... with a monstrous formula. And then I realised that out of stock periods could straddle different years. Back to the drawing board - and that caused too much brain strain. However, thanks to the www, I have a nice solution.

    Check it out...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-05-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    35

    Re: Find length of time between latest and last instance formula

    Now that is something is something special, thank you very much!!! Really appreciate your time on this.

  6. #6
    Registered User
    Join Date
    06-05-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    35

    Re: Find length of time between latest and last instance formula

    Thanks for sharing your knowledge.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find length of time between latest and last instance formula

    You're welcome and thanks for the Rep...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to return latest log out time even if the latest logout time is 12am
    By Shellybelly in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-01-2015, 12:16 PM
  2. [SOLVED] Formula to find last instance in list
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-07-2015, 02:18 AM
  3. Replies: 2
    Last Post: 12-16-2014, 11:58 PM
  4. [SOLVED] Find first instance of time, insert data in next colomn
    By Ben Mayo in forum Excel General
    Replies: 5
    Last Post: 11-04-2012, 04:57 PM
  5. Excel 2007 : Get values for latest instance
    By Sandeep999 in forum Excel General
    Replies: 1
    Last Post: 10-20-2010, 01:06 PM
  6. How do I find the length of time (Years & Months) between 2 dates
    By David Picken in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 03-23-2006, 04:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1