+ Reply to Thread
Results 1 to 11 of 11

Creating A Column In A Pivot Table Based On Certain Data In The Table

  1. #1
    Registered User
    Join Date
    02-03-2024
    Location
    Mesa, AZ USA
    MS-Off Ver
    MS 365
    Posts
    5

    Creating A Column In A Pivot Table Based On Certain Data In The Table

    Hello All!

    I have an Excel spreadsheet that I've exported from our timekeeping software, which includes columns for Job Description, Employee Name, Start & End Times, and a Total for that particular punch time. The issue I'm having is that certain customers require that I report the daily time for each employee as a total, minus any travel time to and from the job. Previously, this was an easy task, since there was only one row per job, per day, per employee, and I could create a new column, only subtracting the specific travel time for that entry. However, starting this month, we've been required to breakdown the punch times for various work stoppages (i.e., customer delays, equipment delays, meal periods, etc.), so there may be as many as 8-10 rows for the same job, for the same day, for the same employee, and there's no way to get a total of the hours worked per day, except to create a pivot table. I'm struggling with how to create a column on the pivot table that would allow me to automatically subtract an hour from the total hours shown as the pivot table will change size, dynamically, depending on which job I filter on.

    As an example, any job description containing the customer, FM Safford, would need to have a total of 1 hour subtracted from each employee's total time for that job on whatever day it was reported, whereas, if the customer is FM Morenci, then that job needs to have 2 hours subtracted from the total time shown for each employee.

    I have attached a sample spreadsheet and pivot table the way I need them to appear.

    Thank you for any help you can provide!
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    You said: "any job description containing the customer, FM Safford, would need to have a total of 1 hour subtracted from each employee's total time for that job on whatever day it was reported, whereas, if the customer is FM Morenci, then that job needs to have 2 hours subtracted from the total time shown for each employee."

    How can Excel tell how many hours need to be subtracted for any individual location?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    02-03-2024
    Location
    Mesa, AZ USA
    MS-Off Ver
    MS 365
    Posts
    5

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    These two customers are the only ones that have this requirement. That's why I'm trying to figure out a way to do this calculation in a column next to the totals shown on the pivot table. I used to just do the calculation manually in the spreadsheet, by filtering by those two customers, and then entering =E2-1 or =E2-2, for example, since there was only one line per employee, per job, per day. But, now that there are multiple lines, I can't do it this way. If I filter and then enter the formula on the spreadsheet, the way I was doing it previously, I would actually end up taking out 3 hours, if there were 3 rows per employee, or how many ever lines there are for each employee on that job. So, if they had 8 "punches" for the day, I'd actually subtract 8 hours total, which isn't what I want to do. I only need to subtract 1 or 2 hours.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    Do you have (or can you get) the INSIDER updates (they're free) for O365? If you CAN do so, you sign up from the account page of Excel. Once done your version (on the account page) will be 2402 (as of today).

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    Are these the expected results?
    Attached Files Attached Files
    Rory

  6. #6
    Registered User
    Join Date
    02-03-2024
    Location
    Mesa, AZ USA
    MS-Off Ver
    MS 365
    Posts
    5

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    Yes, Rory, they are, and I have about 5,000 more rows of data that I need to apply this to, thus the need to have this information calculated automatically, if at all possible. I could do it manually, after I've filtered the pivot table by Customer, but I'd obviously rather not have to do it that way. Thanks!

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    That solution is automated using calculated columns in the data model and power pivot. If you add the rest of your real data to that table and refresh the pivot table, you should see it update accordingly.

  8. #8
    Registered User
    Join Date
    02-03-2024
    Location
    Mesa, AZ USA
    MS-Off Ver
    MS 365
    Posts
    5

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    Thank you for the explanation, Rory, but when I try to copy any additional rows of data, even though they are formatted exactly the same, I lose the Total Hours and Sum of Adjusted Hours in the pivot table you created in the file. I've never worked with Power Pivots, but I was looking at the Table2 you created, and I'm not sure what you're basing the calculations on. It looks like it might be the Employee ID column, but as you can imagine, with nearly 5,000 more rows of data, there are many more jobs, and many more employees. The sample data I provided only shows a small portion, as we have nearly 20 employees on the team, and probably close to 100 different jobs.
    Last edited by WmSWoodson; 02-05-2024 at 06:05 PM. Reason: Additional Information

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    It looks for the earliest time for a given combination of full name, date and job description, which appears to be enough to properly group the data. If not, let me know what is?

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    For whatever reason, you did not respond to my comments at Post 4. I decided to have a play with your dataset, to learn how to use the new GROUPBY function - available on the Insider programme that I referred to in that post.

    For what it's worth... here's the result (It will not work if you DON'T have insider... until these functions are rolled out to all users).

    One formula, calculated in one cell... being a formula it refreshes immediately if any data are changed.

    Take a look, or otherwise, as you please.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-03-2024
    Location
    Mesa, AZ USA
    MS-Off Ver
    MS 365
    Posts
    5

    Re: Creating A Column In A Pivot Table Based On Certain Data In The Table

    I'm sorry, Glenn, but I didn't understand your reference to the "Account" page of Excel. As it turns out, I wasn't seeing what you were talking about, probably because I'm not using O365, like I thought I was. I have two different computers. My personal one and a company laptop. The laptop is using O365, but my personal one only has Office Pro 2016. I've never upgraded my home computer. I thought both machines had the same version. Unfortunately, the version of the software being used on my laptop is dictated by our IT Dept., so I may not be able to upgrade it myself, as only IT team members have admin rights to install new software. However, I'm going to try, and then see if I can use your version to accomplish the task at hand. Thank you!

+ 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. Creating a pivot table with data based on drop down values
    By blueboy90780 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-29-2020, 11:38 PM
  2. [SOLVED] Question Issue creating pivot table from table data
    By TenDeadGoats in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2020, 05:10 PM
  3. Replies: 6
    Last Post: 01-24-2017, 06:56 PM
  4. Creating a Pivot Table using Data Table in different file?
    By JasonMcQueen in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-13-2016, 11:56 AM
  5. Replies: 1
    Last Post: 07-29-2015, 05:19 PM
  6. Creating validation list from table column based on data in another column
    By dreamthrum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-11-2013, 08:38 PM
  7. Creating a pivot table from raw data with both row and column headings
    By marshymell0 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-03-2013, 04:31 AM

Tags for this Thread

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