+ Reply to Thread
Results 1 to 16 of 16

Sorting and filtering complex data (with a pivot table)

  1. #1
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Sorting and filtering complex data (with a pivot table)

    I have a large amount of data, consisting of three columns with many rows. The first column holds the name of items, the second one defines its type and the third one the amount in stock. My goal is to create an interactive (and possibly easy to understand) pivot table that can:

    1. Show only the names of the items of the proper type and/or amount in stock that the user chooses (for example if he wants to see all plumbing-type items that we have exactly 10 in stock)
    2. Show the type and count next to the item name (in columns), despite that they are being at the same time filtered by the user.

    The first problem is I do not know how to achieve the layout/design and the second is that some items have more than one type, for example lets say a certain item is plumbing AND electrical, I want it to show both when the user chooses plumbing and electrical.

    If this cannot be done with a pivot table (or there is just an easier alternative), you are free to offer me other ideas, which I will appreciate, since I do not fancy pivot tables all that much. The main problem is that it has to be interactive and as user-friendly as possible.

    Thank you!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Sorting and filtering complex data (with a pivot table)

    Just my opinion, going to be real hard to suggest a solution with data. How about a sample file a some samples of what you desire?
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    You are right. Sorry. Should have thought of that.

    The file contains example source data and to the right three examples of how it should be formatted and the result of the user defining filters.

    I've included two identical files for different versions of Excel just in case.

    Example.xls, Example.xlsx

    P.S. Having some site trouble, I hope they are attached.

  4. #4
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    Am having problems with the site, attempting to reply and attach files a second time.

    Example.xlsxExample.xls

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Sorting and filtering complex data (with a pivot table)

    See if this works for you. Just pick from the data validation in the "Yellow" boxes.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    Yes, thank you, with the exception of "electronics" it works perfectly.

    Now if you could explain to me how it works?

    P.S. I know VBA, I'm just not that well versed in it yet.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Sorting and filtering complex data (with a pivot table)

    This here might be the best way to explain it...

    http://www.contextures.com/xladvfilter01.html

    There is a programming section also...

  8. #8
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    Ah, yes, thank you, I understood and incorporated the code for an advanced filter. But I have only one question remaining.

    It pertains to the "electrical" issue. The filter works fine for filtering single type items and complex type items, but only if the filtered type is listed first. In other words if I want to filter "hardware", then all "hardware" and the "hardware/electrical" items are listed, however if I want to filter "electrical" the filter does not display "hardware/electrical".
    So my question is how do can I fix that, my only idea is to tell the advanced filter function to filter by placing two wildcard ( * ) symbols on each end of the criteria, thus allowing complex-type items to be filtered. And I don't know how to do that.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Sorting and filtering complex data (with a pivot table)

    You can remove the data validation from J5 and enter *Electronics*.

  10. #10
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    Yes, that would be real easy, but I still need it to be usable by people with no excel exprience. So basically I need to know how to convert the value of the cell J5 to a string, add two "*"s at each end and feed it to AdvancedFilter's criteria need. Seeing as it requres a range as a criteria, I believe it's going to be difficult, no?

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting and filtering complex data (with a pivot table)

    I would recommend AutoFilter on the description as an option. I would move the source data to another sheet, as shown. Give it a try.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  12. #12
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Sorting and filtering complex data (with a pivot table)

    You could also create another sheet named Sheet2 and hide it

    Please Login or Register  to view this content.
    Last edited by mike7952; 09-25-2012 at 08:31 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  13. #13
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Sorting and filtering complex data (with a pivot table)

    you could also use formula criteria
    Attached Files Attached Files
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  14. #14
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    Thank you, everyone, I found the solution with the AutoFilter method.

    Still, could someone explain to me the pros and cons of AutoFilter and AdvancedFilter, I've read a lot about how each method works but I don't seem to understand why shouldn't only one be used always?

    And JosephP, I am intrigued by your method but I don't understand how you managed to make excel filter the data based on a true/false match criteria?

    Thanks again!

  15. #15
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting and filtering complex data (with a pivot table)

    Google is your friend. Type questions like that into Google and you usually get the best answers right at the top:

    Google: Autofilter vs Advanced Filter in Excel

    First answer: http://blog.contextures.com/archives...vanced-filter/



  16. #16
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: Sorting and filtering complex data (with a pivot table)

    Why, thank you, I will ask Google first from now on. :P

    And now I can officially say that this thread is [SOLVED].

+ 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