+ Reply to Thread
Results 1 to 16 of 16

Date and Time display in Pivot Table

  1. #1
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Date and Time display in Pivot Table

    On my data sheet I have the following format:

    Company Name Scheduled Time Actual Time Number variance
    Joe Doe 06/01/10 08:15 AM 06/01/10 08:15 AM 0.010416667
    John Brown 06/03/10 05:12 AM 06/03/10 05:12 AM -0.033333333
    Joe Doe 06/08/10 12:55 PM 06/08/10 12:55 PM 1.288194444
    ... ... ...

    In my pivot table, I want to display the Avg number variance for each company in the following time format:

    0 hour(s) 15 min(s) Late/Early/Ontime

    Which is this formula:
    =IF('Num Var' =0,"On Time",TEXT(ABS('Num Var' ),"[h]"" hour(s) ""m"" min(s) """)&IF('Num Var' <0," Early","Late"))

    but when I enter that into calculate field formula area, it gives me an error #VALUE
    Last edited by ybu1106; 07-19-2010 at 02:16 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    I think a calculated field needs to return a number not a text string (it needs to be something that can be subtotalled....

    Maybe perform the formula outside the pivot table?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    Do you think I can use custom format under field setting for the cell? can you give me the code that displays the following:

    # hour(s) # min(s) Late/Early/On-Time

    (On-time:number variance = 0, Late: number variance >0, Early: number variance <0)
    As stated above, I already have the number variance calculated in the raw data, I just need to find a way to display it.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    I am not the greatest with custom formatting , but I don't think you can format a cell (adding text strings) based on the result of another.... You can use conditional formatting which will change the colour or font style.. you can then perhaps use and colour coding index which tells user what the colour means?

  5. #5
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    But the thing is even if I just do regular "Time/Date" format, it would give me error message for negative values, also if I leave it in numerical format, I have no clue what that number means in terms of hour/min unless I hand calculate it. I don't really know how the forum works, do you know who is expertise with the subject? maybe you can direct me to him? I appreciate your help!

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    If you don't include the actual time in the format... because negative time will result in ###############... then use custom format:

    "Late";"Early";"On-Time"

  7. #7
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    But I want to figure out the average for each company, since there are more than 1 truck that comes in, I need specific numbers to evaluate their on time performance, not just by categories.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  9. #9
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    I've attached a dummy workbook with comments in RED
    Attached Files Attached Files

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    As mentioned, I don't think you can do as you requested in a Pivot table.. you would need to apply the formulas outside the Pivot table.

  11. #11
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    Do know what formula I could use?

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    Why not the same formula you used in the main sheet, just referencing the pivot table column instead?

  13. #13
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    I mean I guess I can just use conditional formatting, but what formula should I do for negative times? So far I have

    Cell Value = 0, "format background green"
    Cell Value >0, "format background red" (but how do I display the negative time, I know I can use ABS funciton but how would I refer to the cell?) I want to use =if(?<0, abs(?)) for the 2nd condition
    Cell Value <0, "format green"

  14. #14
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    I am not sure what you mean... the <0 condition takes care of negative values.. no?

  15. #15
    Registered User
    Join Date
    06-14-2010
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: Date and Time display in Pivot Table

    Nevermind, we are going in a circle

    I formatted into hh:mm:ss and changed it 1904 dating system so it could display negative times

    On the side note, what do the numbers mean like 2.80625 = 67 hrs and 21 mins? how do I convert from that back to number, let's say I want to know what 15 minutes is in numerical format?

    Thanks for your help!

  16. #16
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date and Time display in Pivot Table

    Note that switching to 1904 systems keeps like that until you switch it back.. so other workbooks you open/use will be adapted to that system.

    Post the new (unrelated question) in a new thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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