+ Reply to Thread
Results 1 to 9 of 9

Pivot filter sees duplicates when table doesn't

  1. #1
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Pivot filter sees duplicates when table doesn't

    I have a table that is updated each month. When we add a new month the table sees the departments correctly. In the pivot table, it somehow sees duplicates. It sees all of the departments in the old months as one set, and then all of the departments in the new month as a new set of departments, even though most are the same thing. You can see for example in the attached file that the pivot table filter has two of the department 62, while the table filter only has one 62.

    I can see that some of the departments in the raw data tab have an error on them where it says they are numbers stored as text. I don't know why that is there because the format for the whole column is set to number even though some of the cells have numbers and letters in them.

    I have found two ways to fix this but need help finding one that works quickly all of the time, possibly a VBA solution.

    The ways that fix this are to select the cells with the number as text error and let it convert them to numbers. This is great but there are almost 45k rows with more added each month. For some reason the error triangle doesn't show up sometimes and other times selecting all of the cells and letting it fix all of the cells will crash the program because there are too many rows.

    The other way is to replace the value in the cell with itself. so if I find and replace 62 with 62, then suddenly the pivot table sees all of the 62's as one thing.

    I attached the file to see if it helps.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Pivot filter sees duplicates when table doesn't

    Hello
    I've just converted the column to numbers using the method in one of my posts (last post in thread).


    http://www.excelforum.com/showthread...t=#post4087386

    There's now only one 62 showing in the Pivot table. Does this help?

    DBY

  3. #3
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Pivot filter sees duplicates when table doesn't

    That worked perfectly. I hadn't thought of doing it because there is a mix of numbers and numbers with text in them. But it works great. Thank you so much. Is there a VBA way to do that same thing?
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  4. #4
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Pivot filter sees duplicates when table doesn't

    I'm no VBA expert but I'll try a few things out and get back if anything works.

  5. #5
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Pivot filter sees duplicates when table doesn't

    I did a macro recording while doing the copy paste special multiply, but I couldn't figure out how to get the value of 1 into the code.

    This example from SHG worked for me. http://www.excelforum.com/excel-prog...ly-in-vba.html

    I don't know the difference between .value and .value2, but it works. I have seen other examples of this where people suggested .value = .value and that didn't work for me. I also tried .value = .value * 1 but I kept getting errors when it would hit a value that had numbers and letters in it.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Pivot filter sees duplicates when table doesn't

    Yes, I had some code running but every time at the end of the conversion I was getting run time error 13 type mismatch. But if you found a solution all's well.

  7. #7
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Pivot filter sees duplicates when table doesn't

    I was actually getting #N?A values in some of the cells if I ran it more than once. I switched to this code. I couldn't find a way to copy the number 1 and then paste it directly. Instead I assigned the value of a cell I wasn't using (K2) and then coppied it and did the paste special multiply thing. Then I cleared K2. It works great, even if I run it several times.

    Please Login or Register  to view this content.
    Last edited by nigelbloomy; 06-03-2015 at 01:35 PM.

  8. #8
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Pivot filter sees duplicates when table doesn't

    After more testing we found out that we have departments named 6E4. When multiplied by 1 these turn into scientific notation and i get 6000. After going crazy with this I found an even simpler solution. If you just add ' before each value, then it will stay exactly like it is. Since these are department numbers I don't want to be able to add or subtract them, I want to force them to be text. So in the end this code is the best I could come up with.

    Sorry to keep posting about this. I know I have had problems with this before. Accounting loves to use mixed numbers and letters for their cost centers and it drives Excel Crazy. This code does take a few seconds to run on all 45k rows, but it gets the job done.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Pivot filter sees duplicates when table doesn't

    Nice solution. Where there's a will there's a way!

+ 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. Replies: 0
    Last Post: 03-20-2015, 11:39 AM
  2. [SOLVED] Pivot table doesn't update from external csv while data table does
    By Nick_Berlin in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 11-30-2014, 06:50 PM
  3. Replies: 6
    Last Post: 07-31-2014, 12:56 PM
  4. Pivot table, assigning a cell wo be change the Pivot table filter
    By jwongsf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2012, 05:00 PM
  5. Change Pivot table Filter Based on Cell Value *Multiple Filter items* Possible?
    By Flydd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2012, 06:57 AM

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