+ Reply to Thread
Results 1 to 20 of 20

Lookup & Time Formatted Cells ([h]:mm;@)

  1. #1
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Lookup & Time Formatted Cells ([h]:mm;@)

    Hi there,

    I have a spreadsheet that I need to have lookup values from a exported csv file based on weekending date, name and Time Type. (please see attached files). Either lookup from the csv file or lookup from the csv file opened in Excel .... either would be OK.

    I have manually entered the data for one person (Susan Ball) but I would like the other data to be imported automatically.

    I also need to conditionally format column R. (which is formatted as [h]:mm;@) as:
    0-250hrs = normal clear cell
    250-280hrs = yellow cell
    280-300hrs = Blue Cell
    > 304hrs = red cell

    TIA.

    Stewie.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,716

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Are you still using Excel 2010 or something newer?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Hi Ali,
    I am using 365 but it may be used on 2010.

    Would it make a huge difference?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,716

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    It might!

    Would you please update your user profile (you could do it like mine to show that you are using two versions).

    So, would the users with Excel 2010 have the PowerQuery add-in, and if not, would this be something that they would be able to have installed?

  5. #5
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    I'm sure the users are using 2016 and if not I'm sure would install Power Query.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,716

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    I'm confused - you said 2010 in post #3 ...

    Anyway, I will have a look presently (as I am sure others will - if Olly is around, he'll have a PowerQuery solution for you in no time).

  7. #7
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Sorry Ali,

    I am using Excel on 365 Subscription so if we go with that I'm sure it'll be OK moving forwards.

  8. #8
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Just in case it makes a difference. The OTC Export.csv will be exported at the end of each weekending period and the data will need to be imported for that period. The csv file will then be re exported the next weekending period and the file overwritten.

    Hope that makes sense

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    PowerQuery isn't ideal if you need backward compatibility with Excel 2010.

    Excel 2010 uses older version of PQ engine and will have various issues dealing with connection/query created using Excel 365.
    If the connection/query is created on Excel 2010. Excel 365 will be able to open it and refresh, but will have to apply irreversible change before doing so.

    However, if there is no need to refresh the data on Excel 2010. Then it should be fine.
    Just make sure to avoid data model at all cost, as data model is not backward compatible at all.

    With your current table set up. PowerQuery can't directly load data. As it requires data structure more suited for PivotTable and has merged header & multi-level header.

    Do you anticipate someone needing to open and work on workbook using older version of Excel? If not I'd recommend combining PQ with PowerPivot to generate the table.

    Oh and another question. Does csv get overwritten by export each week? Is there possibility of having individual csv in designated folder that you have access to?
    Or is it the table in Excel that gets updated?
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  10. #10
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    I'm gonna take a punt here. I use Excel 365 and I'll be encouraging the other user to do the same if they are not already.

    So lets assume the only version will be Excel 365.

  11. #11
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Something like attached?

    Transformation done on OTC_Export. There are bit more steps than usual as data format did not conform to standard used by PQ (Ex: Duration/Hours).
    Please Login or Register  to view this content.
    Also added tblSegment (Employee-Department).

    See if this fits your need. Also, if you can clarify what your "Over 304hrs?" means.

    To change source csv location. Double click on "OTC_Export" query and double click on "Source" step in Applied steps pane.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Thanks CK76.

    I'll check it out.

    The "Over 304 Hours" indicates that a person has worked in excess of 304 hour over a 8 week period.

  13. #13
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Hi CK76,

    Thanks heaps.

    How do I now get it to work with the attached file?
    Attached Files Attached Files

  14. #14
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    You'll need to add record for each employee in Sheet3's table.

    Meaning define which segment each employee belongs to.

    Once that's done. Go to Data ribbon tool -> Queries & Connections.

    Right click on OTC_Export query and select Edit.

    Once there, double click on "Source".
    0.JPG

    Then use "Browse" to find and select the file. Query itself doesn't need any change. As it will automatically update with new data.

    See attached mockup - Where I used "UNKNOWN" for all of the employees that wan't in the original sample.
    Attached Files Attached Files
    Last edited by CK76; 07-24-2019 at 10:47 AM.

  15. #15
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Thanks CK76,

    Just looking at Susan Ball ....

    On Sheet 1 (where I manually entered the times) I get 211:00 as the grand total.
    Susan Ball 11:10 07:12 22:31 0:00 29:26 0:00 32:26 0:00 30:41 0:00 32:28 0:00 31:18 0:00 21:00 04:11 211:00

    On Sheet 4 Susan Balls Grand Total is 222:30 from the same (imported) data?
    Susan Ball 11:10 7:12 22:31 0:00 29:26 0:00 32:33 0:00 30:41 0:00 32:28 0:00 31:18 0:00 21:00 4:11 222:30

    I also need a Over 304 hours Column, which is a sum of the Grand Total Normal Hours - 304 hours.

  16. #16
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    That's because you had some text value mixed in with acceptable time value. If you copy your range and paste as values into some other range...
    You should see some values unchanged and some changed to decimal value.

    This caused issue/ambiguity in coercion operation in SUM function, and caused erroneous result in R8.

    Duration data type is tricky to deal with, and usually does not import well directly from csv file (or between different systems). That's the reason why custom column was added to transform it.
    Please Login or Register  to view this content.
    Let me think on best way to add Over 304 hours column.

  17. #17
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Thanks CK76,

    That all sounds very complicated .... is there a workable solution?

    Thanks for all of your assistance. For some reason I was hoping for a simple solution to my issue but it appears to be more complex than I thought.

    Anyway, it's getting later here (1:00am) and I've been trying to work this out all day, so I'm gonna give it a fresh look in the morning.

    Thanks again for your expertise

  18. #18
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    It just looks complex. If you follow each step in applied query pane of the query editor. You can follow step by step how it's done.
    If you have specific question about each of the applied steps, I can explain it in detail for you.

    Workable solution is in the workbook I gave you. If csv file structure does not change. It will automatically handle it.

    As for Over 304 hours. It's best to keep it separate from Pivot Table. Due to different aggregation level (you could use PowerView but that just adds more complexity).
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    See attached for sample. But this isn't a good sample as non of the employee went over 304 hours.
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016 on 365 Subscription (Win 10)
    Posts
    134

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    Cool. Thanks CK76. I've had a quick look at the Over 304 and I'll have a closer look in the morning.

    Did you also see that I was struggling with Conditional Formatting based on values that are formatted as [h]:mm;@ in Column R

    I also need to conditionally format column R. (which is formatted as [h]:mm;@) as:
    0-250hrs = normal clear cell
    250-280hrs = yellow cell
    280-300hrs = Blue Cell
    > 304hrs = red cell

  20. #20
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Lookup & Time Formatted Cells ([h]:mm;@)

    There's few ways to go about that.

    1. Using standard CF, add 3 separate CF with formula.
    Excel uses 1 to represent 24 hours (1 day). So 304/24 = 304 hours.
    If value in R column > 304/24 -> Color Red
    If value in R column = MEDIAN(280/24, Value in R, 300/24)=Value in R -> Color blue
    etc.
    2. Using Cell based on their values (3 color scale) & one additional for the clear cell.
    Make sure to order it from clear cell CF to 3 color scale. And tick "Stop if True" for clear cell CF.

    3. Using KPI measure in Pivot Table
    This can be done using single measure.

    However, your condition excludes some time range or has overlap from post (ex: greater than 300 hrs to less than 304 hrs isn't included in your ranges).
    Should it be...
    0 to <=250 -> No fill.
    >250 to <=280 -> Yellow
    etc

    Or
    0 to < 250 -> No fill.
    >= 250 to < 280 -> Yellow
    etc?

    EDIT: As Ali wrote. It's best to ask it in new thread. If you want me to respond to the new thread. You can PM me with the link to new thread.

+ 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 add 'Time' formatted cells
    By telcocook in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-20-2017, 07:55 PM
  2. IF Statement Help
    By hutchgeo4 in forum Excel General
    Replies: 1
    Last Post: 08-16-2015, 10:48 PM
  3. If statement off cells that are time formatted
    By hutchgeo4 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-12-2015, 02:45 PM
  4. All empty cells in the spreadsheet formatted as time
    By imakosov in forum Excel General
    Replies: 2
    Last Post: 12-10-2014, 09:02 PM
  5. Lookup cells from files that are formatted differently
    By HabsFan89 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-26-2014, 10:58 AM
  6. How to totalise time formatted cells
    By olafurbj in forum Excel General
    Replies: 13
    Last Post: 09-16-2011, 12:32 PM
  7. Add values to time formatted cells
    By Chutney in forum Excel General
    Replies: 1
    Last Post: 11-30-2009, 07:52 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