SOLVED

Getpivotdata with time values working for some not working for others.

Iron Contributor

Hello,

 

I'm having trouble getting GETPIVOTDATA to work with Time values.

 

First, pivot table doesn't recognize time values so I needed to convert them to general format in my data source and base my pivot table on that.

 

I have got  9 different time values starting from 08:00 to 16:00

 

08:00 doesnt work and 09:00 does work. I don't know why. Can you help me out?

I'm attaching a dummy template.

 

Thanks.

 

 

1 Reply
best response confirmed by kheldar (Iron Contributor)
Solution

@kheldar The data you provided is full with #REF errors, probably referring to real employee names that you deleted (though they still show up when you try to filter the pivot table) and replaced by "Employee 1", "Employee 2" etc. None of these fake employees seem to have time records in the span from 8-16, so I changed some of the #REFs to "Employee 1". And to make the GETPIVOTDATA to work, I changed the timestamps in "hours1" to texts with formula:

=TEXT([@hours],"00")&":00"

Then, I also changed the time labels in A4:A12 in the "Morning" table to plain text. This is the result:

Screenshot 2021-10-31 at 08.29.53.png

The numbers, obviously make no sense because I just picked some time entries for each hour and assigned those to Employee 1. But the formula works.

Having done all that, I just wonder why you don't use one or more pivot tables to do the summarisations for you, without complicated formula. A simple PT (with a filter on the time stamp) could result in this:

Screenshot 2021-10-31 at 08.41.02.png

Same result, just looking a bit different. Up to you.

1 best response

Accepted Solutions
best response confirmed by kheldar (Iron Contributor)
Solution

@kheldar The data you provided is full with #REF errors, probably referring to real employee names that you deleted (though they still show up when you try to filter the pivot table) and replaced by "Employee 1", "Employee 2" etc. None of these fake employees seem to have time records in the span from 8-16, so I changed some of the #REFs to "Employee 1". And to make the GETPIVOTDATA to work, I changed the timestamps in "hours1" to texts with formula:

=TEXT([@hours],"00")&":00"

Then, I also changed the time labels in A4:A12 in the "Morning" table to plain text. This is the result:

Screenshot 2021-10-31 at 08.29.53.png

The numbers, obviously make no sense because I just picked some time entries for each hour and assigned those to Employee 1. But the formula works.

Having done all that, I just wonder why you don't use one or more pivot tables to do the summarisations for you, without complicated formula. A simple PT (with a filter on the time stamp) could result in this:

Screenshot 2021-10-31 at 08.41.02.png

Same result, just looking a bit different. Up to you.

View solution in original post