+ Reply to Thread
Results 1 to 13 of 13

Excel 2007 : How to calculate count of certain column values in a pivot table

  1. #1
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    How to calculate count of certain column values in a pivot table

    Hi,


    For a column S, I have 4 set of values - S1, S2, S3 and S4. One more column T having values T1,T2 and T3 for which column S is used to indicate status. Pivot table can be drawn with T and S. With T in the row and S in the row and column.

    T S1 S2 S3 S4
    T1 4 4 5 6
    T2 3 3 3 5
    T3 2 1 4 5

    My question is to have one more column S5 = S1 + S2 + S3

    Resultant :

    T S1 S2 S3 S4 S5
    T1 4 4 5 6 13
    T2 3 3 3 5 9
    T3 2 1 4 5 7

    How this can be done with pivot table? Any ideas are highly appreciated.
    Last edited by nvn_germany; 02-06-2012 at 12:05 PM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to calculate count of certain column values in a pivot table

    You need to create a calculated Item (not Field). You have to select one of the S1-S4 cells in the table before you will be able to add a calculated item.
    Good luck.

  3. #3
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: How to calculate count of certain column values in a pivot table

    Hi,

    Thanks for your reply. Table I have provided is the pivot table and not the table data. Table data for example would be the following:

    T S
    T1 S1
    T1 S2
    T1 S3
    T1 S4
    T2 S3
    T2 S2
    T2 S3
    T2 S4

    From the above table data, following pivot table is required:

    T S1 S2 S3 S4 S5
    T1 4 4 5 6 13
    T2 3 3 3 5 9
    T3 2 1 4 5 7

    where s5 = s1+s2+s3.

    Please let me know if anything is not clear.

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to calculate count of certain column values in a pivot table

    I know that - that is what I was answering.

  5. #5
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: How to calculate count of certain column values in a pivot table

    Since I am a beginner, It would be so kind of you if you can provide more information about the process.

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to calculate count of certain column values in a pivot table

    I do not have 2007 available to test, so will have to do this from memory.
    With your pivot table created, select one of the S1, S2, S3 or S4 header cells, then on the Pivot Table tools tab, look for a button called something like 'Formulas'. Click this, and choose Calculated Item. Enter a name for the item in the dialog (say S5) then in the formula box enter S1+S2+S3 and choose Add.

    I have however just remembered one restriction - you cannot create a calculated item in a pivot field which you also use in the data area - is there another field that you can use for the data besides the T and S fields? If not, you will need a formula in the underlying data table instead.

  7. #7
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: How to calculate count of certain column values in a pivot table

    As you have mentioned I am getting an error message "Calculate item do not work with custom sub totals" on clicking the "Calculated Item" in "formulaes". There are so many fields in the data table, But I need only T and S in the pivot table. How to create a forumula in the underlying table?

  8. #8
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to calculate count of certain column values in a pivot table

    Do you have a text field you can use for the data? If so, there should be no need to use custom subtotals.

    Edit: attached a sample pivot.
    Attached Files Attached Files
    Last edited by OnErrorGoto0; 02-06-2012 at 10:29 AM.

  9. #9
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: How to calculate count of certain column values in a pivot table

    Thanks and Excellent, I have added another column like your example. I have another issue now. In grand total, excel is adding s1 + s2 + s3 +s4 +s5 . Actually, I want grand total from S1 to S4. Please help me with this.

  10. #10
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to calculate count of certain column values in a pivot table

    You would have to recreate the totals with another calculated item using S5+S4. There is no way to get the built-in totals to ignore certain items.

  11. #11
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: How to calculate count of certain column values in a pivot table

    Thanks alot, I have removed grand totals and added a calculated item. Your help is highly appreciated.

  12. #12
    Registered User
    Join Date
    02-06-2012
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: How to calculate count of certain column values in a pivot table

    Please tell me some good place to learn excel.

  13. #13
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How to calculate count of certain column values in a pivot table

    My pleasure.

    Please do not forget to mark the thread solved.

    It depends really on how best you learn. I have learned what little I know from books and experimenting with the program, but you may prefer the structure of classes. Either way, practice is essential to remember it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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