+ Reply to Thread
Results 1 to 9 of 9

Including time/number ranges displayed in a chart

  1. #1
    Registered User
    Join Date
    12-08-2018
    Location
    Syracuse, NY
    MS-Off Ver
    2016
    Posts
    10

    Including time/number ranges displayed in a chart

    Hello,

    Please see attached spreadsheet or screenshot.

    I am working on a spreadsheet in which I have a certain length of session time added to the beginning of a session. There are a given number of sessions with a start date and time (start date and time can vary). I simply add the session length (which can also vary) to the session time in order to get the session end time. On the right side I have a chart (Session active window) in which I want to display the time ranges there is an active session. I manually typed in the time ranges to illustrate what I am looking for. So basically if sessions overlap, I want the output chart "Session active window" to display the time ranges in which a session is active. I've tried a few different things and tried researching different commands but cant figure out a way to do this. Since time is basically viewed as a number in excel, it can be looked at as overlapping numbers rather than time. Any help on this would be greatly appreciated. Thanks,

    Cory
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by coryde87; 12-08-2018 at 06:36 PM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Including time/number ranges displayed in a chart

    Hi, I noted this unanswered query and I am trying to visualise what you are trying to achieve.
    Is the data that you are analysing in a situation that you require to avoid clashes in a real live environment.
    or
    are you analysing past data scenarios, this would determine what approach is considered.
    torachan.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Including time/number ranges displayed in a chart

    Please try

    F4 press Ctrl+Shift+Enter and copy down

    =IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW($C$4:$C$99)/IFERROR($C$4:$C$99>CEILING($D$3:$D$98,"0:01"),1),ROWS(F$4:F4))),"")

    G4 copy down

    =IFERROR(INDEX(D:D,AGGREGATE(15,6,ROW($D$4:$D$99)/NOT((CEILING($D$4:$D$99,"0:01")>=$C$5:$C$100)*(CEILING($D$4:$D$99,"0:01")<=$D$5:$D$100)),ROWS(G$4:G4))),"")
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-08-2018
    Location
    Syracuse, NY
    MS-Off Ver
    2016
    Posts
    10

    Re: Including time/number ranges displayed in a chart

    Hi Bo_Ry,

    Those equations are working, thanks for that. I am trying to follow what you did and i'm getting a little confused at the aggregate command, specifically the array portion of it.

    ROW($C$4:$C$99) Returns a number

    IFERROR($C$4:$C$99>CEILING($D$3:$D$98,"0:01"),1) returns a TRUE or FALSE

    They are separated by a forward slash. How does this end up referring to an array is this context? Thanks,

    Cory

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Including time/number ranges displayed in a chart

    Hi Cory,

    One of the best ways to see what a formula is doing, use evaluate to step thru the breakdown of the formula.

    Sometimes if the range is too large it will be hard to see in the Evaluate interface. If that is the case, shorten the range as a test.

    Evaluate Formula
    • Click on the cell with the formula >> Ribbon >> Formulas >> Formula Auditing >> Evaluate Formula
    HTH
    Regards, Jeff

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Including time/number ranges displayed in a chart

    Hi Cory,

    $C$4:$C$99>$D$3:$D$98 is condition for Session begin, it has to be more than Session end of row before

    Eg:
    C7 9/12/2018 16:00:00 > D6 12/8/18 4:00 PM this is True
    C8 10/12/2018 16:00:00 > D7 12/11/18 4:00 PM, this is False

    CEILING($D$3:$D$98,"0:01") is use for round column D to minute as it come from D5 =C5+(C$1/24) this will have some second or milli-second
    If check =D5=C6 is False

    IFERROR( ,1) is for C4 than can't compare with D3 "Session end"

    When condition are True or False

    Row()/True = row()/1 = row()
    Row()/False = row()/0 = #DIV/0

    Aggregate(15,6, () , k)
    15 for Small , 6 for ignore error like #DIV/0 will pull out row() that have True as condition, combine with index will give result that meet condition.

    All you have to do is find condition that suit your need and put after / for divide.

  7. #7
    Registered User
    Join Date
    12-08-2018
    Location
    Syracuse, NY
    MS-Off Ver
    2016
    Posts
    10

    Re: Including time/number ranges displayed in a chart

    Jeff,

    Thanks for letting me know about evaluate formula. I forgot that existed.

    Bo,

    Thanks. I see what is going on now. I didnt realize excel recognized 1=TRUE and 0=FALSE when used in an equation. There is one other item that is giving me trouble with this.
    If I autofill the formula in column D, for some reason "0" autofills in the session active window in column F. This only happens if there is a formula in column D with blank cells in the same row.
    Even if I throw an IF statement in column D to make the cells blank that should be blank, the 0s still show up in column F. Is there any way to get rid of those 0s besides throwing another IF statement
    on the column F formula to make the cell blank if a "0" is there? See attached spreadsheet. Thanks,

    Cory
    Attached Files Attached Files

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Including time/number ranges displayed in a chart

    Please try

    F4 with CSE

    =IFERROR(1/(1/INDEX(C:C,AGGREGATE(15,6,ROW($C$4:$C$99)/IFERROR($C$4:$C$99>CEILING($D$3:$D$98,"0:01"),1),ROWS(F$4:F4)))),"")


    G4 copy down

    =IFERROR(INDEX(D:D,AGGREGATE(15,6,ROW($D$4:$D$99)/(NOT(CEILING($D$4:$D$99,"0:01")>=$C$5:$C$100)*(CEILING($D$4:$D$99,"0:01")<=$D$5:$D$100)+($D$4:$D$99=MAX($D$4:$D$99))),ROWS(G$4:G4))),"")
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    12-08-2018
    Location
    Syracuse, NY
    MS-Off Ver
    2016
    Posts
    10

    Re: Including time/number ranges displayed in a chart

    Hi Bo,

    Thanks that worked. That's weird doing "1/" twice fixes that but whatever works I guess.

    Cory

+ 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] Can I make the data ranges displayed in a chart vary depending on my no. of data points
    By David Myers in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-06-2014, 02:16 PM
  2. possible to use OFFSET in chart to minimise the number of named ranges?
    By penfold1992 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-04-2014, 10:47 AM
  3. [SOLVED] Set number value displayed in cell when certain text value is displayed in another
    By chrisswann in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-18-2013, 09:07 AM
  4. Number of Counts between Time Ranges
    By homer33doh in forum Excel General
    Replies: 3
    Last Post: 03-10-2011, 10:30 AM
  5. How to add displayed cell value (including format)
    By Banaticus in forum Excel General
    Replies: 3
    Last Post: 05-09-2010, 12:07 AM
  6. Copy worksheet including named ranges not including macros
    By urungus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-07-2009, 01:38 PM
  7. Help! Limit on number of Ranges you can use at one time?
    By Sandy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2005, 04:05 AM

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