+ Reply to Thread
Results 1 to 8 of 8

Thread: Pivot Table question

  1. #1
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Pivot Table question

    Hi
    I have created a database in access for recording results of our local parish questionnaire. I'm analysing the results as a Pivot table in Excel.

    The data looks like this (a snapshot of question 9 responses)
    AgeGroup DescriptionQuestionID
    25 - 34 a 9
    25 - 34 b 9
    25 - 34 c 9
    25 - 34 Other 9
    25 - 34 a 9
    25 - 34 b 9
    25 - 34 d 9
    35 - 44 d 9
    35 - 44 e 9


    So the table has the "agegroup" in the row area, the "description" in the column area and I’m counting the questionid's so I get

    Count of QuestionID Description
    AgeGroup Other a b c d e Grand Total
    25 - 34 1 2 2 1 1 7
    35 - 44 1 1 2
    Grand Total 1 2 2 1 2 1 9


    What I was trying to show is what is the percentage of responses to that question against the total number of people responded. So I thought that will be easy as well. I know how many people responded so I’ll just create a calculated field that takes the count of the questionid/ [no of responses]


    So for example if 2 people have responded with answer "More visible police presence" out of 10 people who filled out the questionnaire it should be 20%... Well I can't get it to work inside the pivot table.

    If my new calculated field (field1) is =COUNT(QuestionID) /10
    It just displays
    Description
    AgeGroup Data Other a b c d e Grand Total
    25 - 34 Count of QuestionID 1 2 2 1 1 7
    Sum of Field1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
    35 - 44 Count of QuestionID 1 1 2
    Sum of Field1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
    Total Count of QuestionID 1 2 2 1 2 1 9
    Total Sum of Field1 0.1 0.1 0.1 0.1 0.1 0.1 0.1

    As opposed to taking the count of the question in each of the columns and displaying what I want

    It works quite happily outside the table by doing the simple calculation but that’s no good as I have 60 questions and want to produce a page for each one

    Am I missing something obvious?

    Thanks for you time
    Attached Files Attached Files
    Last edited by NickWard65; 04-02-2009 at 04:13 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Pivot Table question

    Perhaps you can add a column in the General Query tab that does the calcs and then create Pivot Table to include that item
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Pivot Table question

    Thanks for the reply. I have tried adding a extrs column that holds the total of the reponses, as tried to show the "count of questionid" as a precentage of the new responses field but i get #NA on all the values. I can't thing of what formula you would need to show the data in the way that i want

    thanks

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Pivot Table question

    Can we see an example of what you've done?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Pivot Table question

    this where i'm up to so far!
    Attached Files Attached Files

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Pivot Table question

    see attached... Sheet2... is this what you need?
    Attached Files Attached Files
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Pivot Table question

    You are a God! thank you
    I don't suppose you could quickly explain what you have done in particular what the -- does.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Pivot Table question

    The Sumproduct() formula here counts number of items that match multiple criteria...

    i.e. =SUMPRODUCT(--($B$2:$B$187=B2),--($C$2:$C$187=C2))

    counts how many rows with row 2 and 187 column B = B2 and column C = C2 (much like Countif()) but allows for 2 or more criteria.... then that sum is divided by D2 to get the final average...

    the -- coerces the TRUE/FALSE results obtained by the conditions to 1/0 respectively so that the math can be performed and sumproduct functions as designed.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0