How can I calculate the maximum number of days between two dates in a range of dates?

I have a column of dates spanning the couse of a few months.  I would like to know if I can calculate the maximum number of days between each row and display the highest number.  I currently have another column that calculates the days betwen the rows and I am currently just looking at the totals and highlighting the highest period.
Is this possible?  Any help or suggestions are appreciated.
Thank you,
Trevor

This sounds totally possible,  Can you post a screen shot of your table to make responding more focused?  If you mean you want to:
A) compute the difference (in days) between two date in the same row, then
B) find the max duration (in days)
Here is my take on this problem:
D2 = C2-B2
select D2 and fill down
F1=MAX(D)
to perform the conditional formatting (to highlight the max duration) select column D, then set up conditional formatting as shown in the 1st image

Similar Messages

  • Find Exact number of days between two dates

    How can get the exact number of days between two dates?

    An example of business days calculation in SQL */
    /* The algorythm is: */
    /* 1) Take the absolute difference between the dates */
    /* to_date('&todate') - to_date('&frdate') */
    /* 2) Subtract the weekends (number of weeks in the range */
    /* TRUNC(to_date('&todate'),'D') = 1st day of week that */
    /* end of period is in */
    /* TRUNC(to_date('&frdate'),'D') = Last day of week that */
    /* start of period is in */
    /* So subtracting these two gives the number of days */
    /* between the two dates but including all of the days in */
    /* the weeks that the dates start and end in. When this */
    /* number is divided by 7 it gives the number of weeks. */
    /* Multiplying by 2 gives the number of weekend days.     */
    /* 3) Subtract 1 day if the ending date is on a saturday */
    /* DECODE(to_char(to_date('&todate'),'D'),7,-1,0) */
    /* --> If the day of the week is saturday (7), returns -1 */
    /* 4) Subtract 1 day if the start date is on a sunday */
    /* DECODE(to_char(to_date('&frdate'),'D'),1,-1) */
    /* --> If the day of the week is sunday (1), returns 1 */
    /* 5) Add one day to make the range inclusive (The '1 + ' ) */
    /* Author: Kenneth Atkins ([email protected]) */
    /* http://www.olywa.net/katkins/oratip */
    define frdate = '&1'
    define todate = '&2'
    set verify off
    select      
         '&frdate' From_Date
         ,'&todate' To_Date,
         1 + to_date('&todate') - to_date('&frdate') -
         ((TRUNC(to_date('&todate'),'D') - TRUNC(to_date('&frdate'),'D'))/7)*2
         + DECODE(to_char(to_date('&todate'),'D'),7,-1,0)
    + DECODE(to_char(to_date('&frdate'),'D'),1,-1,0) Business_Days
    from dual
    Here is an example of running the script:
    SQL> @busdays 01-AUG-96 15-AUG-96
    FROM_DATE TO_DATE BUSINESS_DAYS
    01-AUG-96 15-AUG-96 11

  • How can I set the maximum number of restarts for my PDF files?

    I want sent my PDF to a friend,but I just allow him see it only twice.
    How can I set the maximum number of restarts for my PDF files?
    My software edition is Acrobat X

    In the old days when PDFs were only opened on desktops and only in Acrobat or Reader, scripting could fake security features and people were generally convinced. As there are so many ways to open a PDF without scripts ever being run (from mobile devices to in-browser display, or simply opening the file in Illustrator), none of that works anymore.

  • How can i fix (the maximum number of free accounts have been activated on this iphone)

    how can i fix (the maximum number of free accounts have been activated on this iphone)?
    please help to me.it`s for iphone 4S.

    You can't 'fix' it. It's not broken. That's the way it's designed.

  • I wanted to know how do you calculate the number of days between two dates

    i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • How can i get number of days between two dates represented by two dates?

    how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?

    tej_222 wrote:
    But how do I do that conversion. from java.sql.date and java.util.date to calender?
    -thanks for the quick response.You may find the following utility code samples useful:
    [http://balusc.blogspot.com/2007/09/calendarutil.html]
    [http://balusc.blogspot.com/2007/09/dateutil.html]
    ganeshmb wrote:
    (date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
    getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar.

  • How to calculate number of days between two date in Template design?

    Hello guys
    I have a situation where I have to create a template that returns data, and one of the thing of the existing report is that there is a column that is actually the number of days between start date and end date columns..
    So in template, how would I be able to do the same? I have start date and end date columns on the template, now when I created another column using expression like end date - start date and preview the template, I am getting errors saying :
    Caused by: oracle.xdo.parser.v2.XPathException: Cannot convert 03/31/2009 to number.
         at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:1534)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:521)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:489)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:271)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:155)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:192)
    Please advice
    Thanks

    Hi
    There is an extension function you can use, from the javadoc:
    date_diff
    public static long date_diff(java.lang.String format,
    java.lang.String fromDate,
    java.lang.String toDate,
    java.lang.String locStr,
    java.lang.String tzID)
    Method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only Gregorian calendar.
    Parameters:
    format - the format to which the difference is required; allowed formats are y (for Year), m(for month), w(for week), d(for day), h(for hour), mi(for minute), s(for seconds) and ms(for milliseconds)
    fromDate - the first date
    toDate - the second date
    locStr - locale string -> lang-Territory
    tzID - timezone ID ->http://java.sun.com/j2se/1.4.2/docs/api/java/util/TimeZone.html
    Returns:
    the difference in dates in the desired format
    For example
    <?xdoxslt:date_diff(‘d’,’2009-09-14’, ‘2009-09-20’,’en-US’,1)?>
    give a result of 6
    You can substitute in columns for the dates, just remember the date format required.
    Regards
    Tim

  • Number of days between two dates

    I have two dates-String Date1, String Date2(format of both the dates is 'DD-MM-YY'eg;'28-Jan-2008'). I want to find the difference between these dates;ie if value of String Date1 is '28-Jan-2008' and value of String Date2 is '28-Jan-2009', I need to find the number of days between these dates. What need to be done? Can anyone help me out please.
    Thanks in advance for all the help.
    Regards,
    Anees

    Doing a search is a bit ineffiecient. I'd take advantage of the fact that dates are acually stored in milliseconds. Subtract the two millisecond values (Data.getTime()) and divide by the number of milliseconds in a day. One complication, though, is daylight saving time but if you round rather than truncate in the division it should be fine.
    private static final long MILLIS_PER_DAY = 24L * 60L * 60L * 1000L;
    int dayDiff = (int)((date2.getTime() - date1.getTime() + MILLIS_PER_DAY/2)  / MILLIS_PER_DAY);

  • How can we increase the maximum number of records which we export from UME

    Hi All,
             Is there any way to increase the maximum number of records which we can export from the UME.
    Please give your valuable suggestions as soon as possible.
    Thanks in Advance
    Regards,
    Ramalakshmi.S

    I didn’t find any configuration you can set to increase the number. I think it is related UI. The number is designed programmatically.
    Lisa Zheng
    TechNet Community Support

  • SQL to count the number of days between two dates

    Does any one have or know how to count the number of days/weeks between 2 dates.
    I have thought about using MONTHS_BETWEEN, but do not know how to make it accurate down to one day?
    Any suggestions would be appreciated.

    here are the different queries I came up with to do this, you may want to check it for perticular cases involving Sun and Sat as start and end dates.
    select to_number(to_char(to_date('21-JUL-00','dd-mon-yy'), 'ww'))
    - to_number(to_char(to_date('10-JUL-00','dd-mon-yy'), 'ww')) from dual;
    select (Next_Day(to_date('21-JUL-00','dd-mon-yy')-1, 'Sunday')
    - Next_Day(to_date('10-JUL-00','dd-mon-yy')-1, 'Sunday'))/7 from dual;
    select (Next_Day(to_date('21-JUL-00','dd-mon-yy')-6, 'Sunday')
    - Next_Day(to_date('10-JUL-00','dd-mon-yy')-6, 'Sunday'))/7 from dual;
    null

  • How to set up the maximum number of messages on a queue programmatically

    Hi,
    I am using IMQ 3.5 to implement a message layer for one of my projects. I created a "Job Status Queue", which receives job status report from a java application every minute. But I just want to keep the most current status report instead of all the job running history. How can I restrict the maximum number of messages to 1 programmatically?
    Any suggestion or help will be appreciated.
    Xiaoyun Tang

    You can't limit the destination size programmatically, but you can do it administratively and associate a behavior to occur when the limit is reached. In your case it sounds like you want a queue, 1 message deep, and to discard the oldest message when the queue is full. When you create the physical queue on the broker you can specify these attributes (you can also update them on an existing queue). For example:
    imqcmd create dst -t q -n StatusQ -o maxNumMsgs=1 -o limitBehavior=REMOVE_OLDESTFor more information see Chapter 6 of the Message Queue Administration Guide. In particular the "Managing Destinations" section:
    http://docs.sun.com/app/docs/coll/MessageQueue_35_SP1
    Joe

  • Number of days between to dates

    Hello to all,
    I would like to define a formula to calculate number of days between two dates and update the value in a key figure.
    *operand: {Name of keyfigure,Fecha ini (Mes/Año),Fecha Fin (Mes/Año)}
    DATA FECHAINI  TYPE ZIOV_FEIN.
    DATA FECHAFIN TYPE ZIOV_FFIM.
    DATA INI             TYPE 0CALMONTH.
    DATA FIN            TYPE 0CALMONTH.
    DATA DIA_INI      TYPE D.
    DATA DIA_FIN     TYPE D.
    DATA DIAS          TYPE F.
    FOREACH FECHAINI, FECHAFIN.
      INI = FECHAINI.
      FIN = FECHAFIN.
    *C2DATE Determine end period date
      DIA_INI = C2DATE(INI, E).
      DIA_FIN = C2DATE(FIN, E).
      DIAS = DIA_FIN - DIA_INI.
    {ZIOV_DIAS,FECHAINI,FECHAFIN} = DIAS.
    ENDFOR.
    Problem: UPF057 type F conflicts with type D. 
    Help would be much appreciated.
    Regards,
    Patrícia

    The function is built in:
    CALL METHOD CL_RSAR_FUNCTION=>DATE_DIFF(
      EXPORTING I_DATE_1 = L_ARG2
                I_DATE_2 = L_ARG3
      IMPORTING E_RESULT = L_ARG1  )

  • Calculate business day between two dates

    Hi Guys
    I need the count of business days between two  dates
    Date1, Date2 i need the count only business day (exclude sartuday&sunday)
    If date1 is null or nothing i need to pass 0
    If date2 is null or nothing i need to pass 0
    help on this

    Hi,
    To achive this within SSRS, go to the report code window and add the below
    Function getBusinessDaysCount(ByVal tFrom As Date, ByVal tTo As Date) As Integer
    Dim tCount As Integer
    Dim tProcessDate As Date = tFrom
    For x as Integer= 1 To DateDiff(DateInterval.Day, tFrom, tTo) + 1
    If Not (tProcessDate.DayOfWeek = DayOfWeek.Saturday Or tProcessDate.DayOfWeek = DayOfWeek.Sunday) Then
    tCount = tCount + 1
    End If
    tProcessDate = DateAdd(DateInterval.Day, 1, tProcessDate)
    Next
    Return tCount
    End Function
    In the textbox where you need to display the value, add the below expression
    =Code.getBusinessDaysCount(parameters!StartDate.Value,parameters!EndDate.Value)
    It is assumed the you want to pass the two days from parameters named Startdate and EndDate. If not, modify the expression with required values.
    Regards
    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH

  • How can we modify the maximum no. of columns in pivot table ?

    hi all,
    How can we modify the maximum no. of columns in pivot table ?
    do i need to change the nqconfig.ini or instanceconfig file or else?
    thnx..

    A little search on the forum :
    In the instanceconfig.xml add a <PivotView> element under <ServerInstance> if one does
    not exist already.
    Within the <PivotView> element add an entry that looks like:
    <MaxCells>nnnnnn</MaxCells>
    where nnnnnn is your desired limit for the maximum total number of cells allowed
    in a pivot.
    Warning: an excessively large number will cause more memory consumption and
    slower browser performance.The details here :
    Oracle BI EE (10.1.3.2): Maximum total number of cells in Pivot Table excee

  • How can i calculate the average in java

    how can i calculate the avergae mark out of two marks for instance in like exam mark out
    of two other ones
    thanks for considering this message

    Average or Mean:
    sum_of_N/N
    Here N is the number of marks.
    sum_of_N is the total sum of n(all marks added together)
    public int average(int[] marks) {
    int sum;
    sum = 0;
    for(int i=0;i < marks.length;i++) {
    sum=marks[i]+sum; // keep adding to the total
    return average = sum/marks.length;
    // warning- using an int here can be a pitfall(we could have a decimal outcome).
    }

Maybe you are looking for

  • What is difference between GL and PA period common and GL and PA period is

    Hi Experts, Can you please help me in understanding the difference between having common PA and GL period and uncommon PA and GL period. I am only aware of common PA and GL period where in implementation option there is one check box which need to ch

  • New Ipod not updating or been seen by Itunes

    Yesterday I bought a new black Ipod Nano to replace the one that got broken in a freak accident. I plugged in the new Nano into my PC, go the popup stating the software on the Ipod needed to be updated. So I went ahead and ran the Ipod Updater. Then

  • Information on HR project implementation

    Hi All, We are planing to implement SAP HR. We would like to know strengths and weaknesses of the variety of technologies SAP employs to process data, develop interfaces, send notifications, etc.: ABAP, SAP workflow, XI, etc. Please provide the infor

  • [SOLVED] transmission-daemon segfaulting, trapped, and others

    Hey guys, Originally I was having the same problem with Rtorrent when I hit about 4000 torrents. Now I'm slightly above 6000 torrents with Transmission, and it has recently started crashing with messages like these in the syslog: [1556037.507253] tra

  • My notebook laptop start beeping after hp screen when i turn on my laptop.....

    1. product name and number--- hp pavilion dv7-1260us notebook entertainment pc 2.operating system installed--- windows 7 64-bit 3.error message--- when i turn on my laptop it starts beep sound continuously after hp screen and touch pad also not worki