+ Reply to Thread
Results 1 to 10 of 10

Formula for date since last entered value

  1. #1
    Registered User
    Join Date
    06-07-2016
    Location
    Socal
    MS-Off Ver
    365 Pro Plus
    Posts
    12

    Question Formula for date since last entered value

    Hello,

    Im working with Excel 2013 trying to build a spreadsheet for currencies. In particular there needs to be a event every 45 days in most cases. How to I calculate the date of a event (usually 1-3 events per row per column)?

    I.E. 1 takeoff event from column L was last logged L41 on 5/21/16 or 17 days ago? I have multiple columns with different event times but would like to display the days since each last event in the top right from todays date. Basically want to see the days since last entry besides "0" for a particular column.

    I've attached my working document if that helps.

    I appreciate any guidance on how to do this.

    Thanks,
    Pat
    Attached Files Attached Files

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula for date since last entered value

    Use in l12 the following formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where
    AGGREGATE(14,6,--(L14:L1000=1)*ROW(L14:L1000),1)
    gives you the Excel row where is the last value equal to 1.

  3. #3
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Formula for date since last entered value

    For your Takeoff item, enter the following ARRAY formula where you want the days to appear:

    {=TODAY()-MAX(IF($L$14:$L$59=1,$A$14:$A$59))}

    Don't forget to press Ctrl+Shift+Enter to make it an array formula.

    You can use the same principle for the others and potentially use conditional formatting to highlight if it's over the number of days required.
    Excel is a constant learning process and it's great to help each other. If any of us have helped you today, a click on the "reputation" star on the left is appreciated.

  4. #4
    Registered User
    Join Date
    06-07-2016
    Location
    Socal
    MS-Off Ver
    365 Pro Plus
    Posts
    12

    Re: Formula for date since last entered value

    Thanks to both of you for the quick reply!

    Shirley,

    Great help I got it to work pretty much how I want it to. A couple questions if you don't mind...

    1. Is there a way to make it read over 1 landing, i.e. 2,3,4 etc? If someone does 2 landings in that segment the sheet wont recognize a event if it is anything other than 1.

    2. Is there a way to differentiate which aircraft have the event? I.E 1B, 1C, 9, C? I believe it is some kind of if formula. The aircraft have different currency requirements and It'd be nice to be able to have it split into in the formula based if the 1B,1C,9, C fields have a 1. I.E. I plan on having days since landing in 1B, days since landing 1C, etc at the top of the sheet.

    3. This isn't the end of the world but some of my values don't have a entry yet, returning a "42529" value for something that isn't accomplished in the sheet yet. Like I said not the end of the world, Getting the other stuff working is my top priority.

    Thank you so much for taking the time out of your day to assist me!

    Pat

  5. #5
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Formula for date since last entered value

    Hi Pat,

    Item 1 should be fairly straightforward - you can just change the formula to show >0 instead of =1.

    Items 2 and 3 are a bit trickier, partly because of the way the data is structured. My problem would be that if you have an entry in 1B and 1C say for a particular date, how would you know which one to assign the take-off, landing, etc to?

    I've got a suggestion on how you could change your data layout to make it a bit more flexible by using a table, then you could get your other data with a pivot table. I'll knock up a quick example for you... watch this space

  6. #6
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Formula for date since last entered value

    Hi again Pat,

    I had a play around with my table idea, but when I looked a bit more at your data I wasn't sure that I have a clear enough understanding of how you're using your spreadsheet and, although it would make it more flexible in some ways (e.g. if you add more aircraft), it might make your data entry take longer. Something that needs a bit more consideration I think.

    So I had a bit more of a think about your 3 questions and have come up with a formula which I think covers them all. I put your aircraft references in E3 to H3,
    then this formula in E4, so the MQ-1 Takeoff days for aircraft 1B:

    {=IF(TODAY()-MAX(IF($L$14:$L$59+$B$14:$B$59>=2,$A$14:$A$59))=TODAY(),0,TODAY()-MAX(IF($L$14:$L$59+$B$14:$B$59>=2,$A$14:$A$59)))}

    Note that it's still an array formula so you need to press Ctrl+Shift+Enter each time you edit it.

    You can then copy this across and down for your other aircraft and Takeoff, landing, etc, but you'll need to adjust the ranges in each case. This checks to see if the result of the calculation is the same as today's date and puts 0 if it is, or runs the MAX(IF...) calculation if it isn't.

    One other way you can make the formula a bit easier to read and to save you adjusting ranges when you add more rows is to convert your existing data to a table. I did this in the attached example and the formula in E4 now looks like:

    {=IF(TODAY()-MAX(IF(Table1[Takeoff]+Table1[1B]>=2,Table1[Date]))=TODAY(),0,TODAY()-MAX(IF(Table1[Takeoff]+Table1[1B]>=2,Table1[Date])))}

    It's exactly the same as the one above, but using the column headers just makes it easier to read and auto adjusts as the rows grow.

    Hope that gives you enough to be going on with
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Formula for date since last entered value

    I just had one of those "derrr" moments Of course you can just check the total of the airplane column to see if you entered anything there!

    {=IF(SUM(Table1[1B])=0,0,TODAY()-MAX(IF(Table1[Takeoff]+Table1[1B]>=2,Table1[Date])))}

    Sorry - it was quite late in the evening when I posted before

  8. #8
    Registered User
    Join Date
    06-07-2016
    Location
    Socal
    MS-Off Ver
    365 Pro Plus
    Posts
    12

    Re: Formula for date since last entered value

    Shirley,

    That was awesome! So much easier!!

    I have a couple small questions if you have the time....

    1. I was trying a OR formula =<> for the 1B/1C takeoff portion(they count the same with currencies) and couldn't get it to work. Is there something Im doing wrong? See 1 Takeoff

    2. How would I extend the table all the way down to future proof the sheet? I went to total rows and it said it would effect the formulas so I got scared and hit cancel.

    3. I'd playing with the SUMIF formula to break the flight hours into sub categories for each aircraft (1b,1c,9,c) and display that in another area but can't figure out where Im going wrong. Id think it be as east as a SUMIF 1B is >0 sum Primary but not so much

    Best Regards,
    Pat
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Formula for date since last entered value

    Hi Pat,

    See you're trying new things already

    Let me take a look and I'll get back to you. Might not be tonight (it's 11:15 pm in England!) but I will see what I can do in the morning.

    Cheers
    Shirley

  10. #10
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Formula for date since last entered value

    Hi Pat,

    I've had a look at your latest version and your questions:

    1. To merge the 1 Takeoff for both 1B and 1C I've just added both of those columns into the calculation so it now looks like this:

    {=IF(Table1[[#Totals],[1B]]+Table1[[#Totals],[1C]]=0,0,TODAY()-MAX(IF(Table1[Takeoff]+Table1[1C]+Table1[1B]>=2,Table1[Date])))}

    As you can see, the first part is now looking at the #Totals row in the table, which links into...

    2. As you found out, you can add a "Total Row" to your table with the option on the table design tab. This is a great feature as it will just update the totals as you add more rows and will always stay at the bottom. As shown in Item 1, you can also use these #Totals in your formulas. If you want to add a new row to your table, go to the last column (comments) and select the last row ABOVE the Total row and press the Tab key. This will add a new row to your table, including any formatting. If you had formulas in any of your rows, it would also copy these down to the new row automatically.

    3. For your Flight hours total, I've used the SUMIF formula which is where I think you were going with this.

    =SUMIF(Table1[1B],1,Table1[Primary Time])

    This doesn't need to be an Array formula by the way. At the moment it only includes the Primary Time, but you could extend it to use Secondary time as well if you wanted to.

    I changed another couple of things, just as suggestions:

    In your first area for "Days Since", I changed the Due Days to a number and added a new column for "Warn". I've then used these to drive some conditional formatting in column B. When the number in B hits the Warn figure it turns Amber, then turns red when it is equal to or above the Due days giving you a RAG status.

    I also added conditional formatting to your airplane columns (1B, 1C, 9 and C table columns) which highlights them in red if you put in a tail number but none of these have a "1". It acts as a kind of warning that you have some data without an airplane assigned. I did this because I noticed that the Flight Hours total didn't match the Primary Time column total and noticed some missing data.

    There are comments attached to some of the cells I changed just to give you a guide.

    Hope all that helps. I've attached another new version for you.

    Shirley
    Attached Files Attached Files

+ 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. Formula to match last date entered in latest column
    By Jay_Bannister in forum Excel General
    Replies: 5
    Last Post: 04-01-2016, 08:24 AM
  2. Date Formula and leaving cell blank when no date is entered
    By Texguy02 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-31-2015, 02:57 PM
  3. conditional formula, if date entered, include in totals
    By arbert in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-24-2012, 09:29 PM
  4. Cell formula to record many values and date entered
    By Stryda in forum Excel General
    Replies: 11
    Last Post: 11-13-2011, 04:28 PM
  5. Time calculation formula, how to stop it once date is entered.
    By twiles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2010, 11:38 AM
  6. Replies: 0
    Last Post: 05-25-2009, 06:58 PM
  7. Replies: 1
    Last Post: 03-11-2005, 12:59 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