+ Reply to Thread
Results 1 to 4 of 4

can't get pivot table with calculated fields right

  1. #1
    Registered User
    Join Date
    08-23-2022
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    66

    can't get pivot table with calculated fields right

    Hi,

    specifically using a pivot table so the table automatically adjusts when rows are added or removed from the source table, but I can't get it to work and look the way I want it to.

    Thanks a lot for looking!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: can't get pivot table with calculated fields right

    You can't get the result you want with a pivot table. since some of the data is text.


    First sort the data on name and date from small to large.

    With formula's in the yellow cell.

    The result is in the green cells with VLookup.

    Notice the result is differant than your result.

    The differance is the color, since I expect you want the color on 01-01-1970 have the same color as the last value.


    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,060

    Re: can't get pivot table with calculated fields right

    Add 3 helper columns:
    most recent date: =AGGREGATE(14,6,[date]/([name]=[@name]),1)
    how often date = 1-1-1970: =COUNTIFS([name],[@name],[date],DATE(1970,1,1))
    color at most recent date: =IF([@date]=[@[most recent date]],[@color],"")

    Then in PivotTable, filter away the blank in "color at most recent date" field.
    Attached Files Attached Files

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: can't get pivot table with calculated fields right

    maybe

    name date color Count of date
    Jane
    01/01/1970
    Red
    1
    Mark
    01/01/1970
    Orange
    1
    Tom
    01/01/1970
    Green
    2
    Attached Files Attached Files

+ 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] Power pivot or pivot table for connecting data and creating calculated fields
    By jaryszek in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 02-06-2019, 08:31 AM
  2. Calculated Fields in Pivot table
    By Biplab1985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2017, 11:43 AM
  3. Replies: 2
    Last Post: 10-26-2015, 06:49 AM
  4. Pivot Table Calculated fields help
    By james.halliwell in forum Excel General
    Replies: 1
    Last Post: 11-07-2009, 03:12 AM
  5. Replies: 0
    Last Post: 03-16-2009, 05:42 PM
  6. Pivot Table calculated fields
    By tigertim71 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-15-2008, 04:58 AM
  7. calculated fields in pivot table
    By minkus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2008, 12:15 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