+ Reply to Thread
Results 1 to 10 of 10

Thread: Max Function in Pivot Analysis

  1. #1
    Registered User
    Join Date
    07-20-2010
    Location
    Washington D.C.
    MS-Off Ver
    Excel 2007
    Posts
    4

    Max Function in Pivot Analysis

    I have a chart of about 40,000 lines that I need to analyze. It's the results of a large survey (topic changed for privacy). Multiple users applied tags to a piece of content. For instance, if I gave you www.cnn.com and asked you to mark it as a website for: News, Media, or Entertainment, you would mark one. Multiple users did that. What I have to do for the 5,000 items that were surveyed is to figure out which answer users answered most. So in the pasted example below, for CNN there were 4 responses, and 2 people marked News. So News is the answer I want. Pivot tables give a nice layout of what those are, but I can't go through 5,000 items (like CNN.com) to manually look up the max for each. What function can I use to automate this? Any help appreciated- Thanks!

    Row Labels Count of Final Answer

    www.cnn.com 4

    news 2
    media 1
    entertainment 1
    Last edited by sez3; 07-20-2010 at 03:26 PM.

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

    Re: Max Function in Pivot Analysis

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    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
    07-20-2010
    Location
    Washington D.C.
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Max Function in Pivot Analysis

    Thanks for the suggestion. I've created a spreadsheet as an example of what the data looks like (on a smaller level obviously). Thanks for the help!
    Attached Files Attached Files

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

    Re: Max Function in Pivot Analysis

    Ok, see if this helps...

    First, I changed the PT layout to Tabular form so that I have separate columns for each category.

    Then I applied a formula in G8 to basically put the Item name in each cell...

    =IF(RIGHT(D8,5)="Total","",LOOKUP(REPT("z",255),$D$7:D8))
    copied down.

    Then formula in H8 to get you the most occurring Answer:

    =IF(G8="","",IF(E8=INDEX($E$8:$E$23,MATCH(1,($G$8:$G$23=G8)*($F$8:$F$23=MAX(IF($G$8:$G$23=G8,$F$8:$F$23))),0)),E8,""))
    which must be confirmed with CTRL+SHIFT+ENTER and copied down.

    You can adjust ranges to suit your actual pivot table.
    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.

  5. #5
    Registered User
    Join Date
    07-20-2010
    Location
    Washington D.C.
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Max Function in Pivot Analysis

    Thank you! I think it is making sense but am still working through the equation and translating into my sheet. Thank you for the immediate help and I will reply back more in full in a bit when I've worked through this enough to understand.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Max Function in Pivot Analysis

    Right-click the answer field, choose Filter-Top 10 and set it to Top 1 by Count of Respondent. See attached.
    Attached Files Attached Files

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

    Re: Max Function in Pivot Analysis

    An alternative formula to get the results to show up in line with first occurance of item would be:

    =IF(OR(G8="",G7=G8),"",INDEX($E$8:$E$23,MATCH(1,($G$8:$G$23=G8)*($F$8:$F$23=MAX(IF($G$8:$G$23=G8,$F$8:$F$23))),0)))
    Confirmed with CTRL+SHIFT+ENTER not just ENTER...

    Note: You still need helper column.


    P.S. Romperstomper's suggestion is a great alternative to not having to use formulas... but it lists either all your values or only your top values.... not both. But you can do 2 separate Pivots....
    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.

  8. #8
    Registered User
    Join Date
    07-20-2010
    Location
    Washington D.C.
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Max Function in Pivot Analysis

    That is awesome!! Exactly what I was looking for Romperstomper!
    @NVBC, thank you very much for spending time. I think your equation works, I'm just not sophisticated enough in Excel to fully get it. I very much appreciate you spending time on it.
    @Romperstomper- thanks a ton- that's great! Exactly what i was trying to do. Appreciate the help.

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

    Re: Max Function in Pivot Analysis

    Sorry for having overcomplicated it... sometimes your mind bends the wrong way

    Please remember to mark the thread as Solved.
    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.

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Max Function in Pivot Analysis

    Luckily I'm too simple to overcomplicate things generally!

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