Thursday, May 8, 2008

always learning

thanks to a colleague asking me a question about doing an access query to get rid of duplicate records, i have learned 2 new-ish tricks. well, okay. only one. but i figured out a new use for a pivot table (PIVOT!) and that counts as a trick in my book. suffice it to say, i'm still and even-more smarter than JMM.

after searching for "unique" query access, and seeing the instructions were 1000 pages long, i quickly decided this must be doable in excel. guess what? i was right. you can delete duplicate records in excel much faster. and--since his original records are in excel to begin with, who needs access???

trick #1 - select all the columns and rows in your data range, go to your data menu and use the Advanced Filter to only copy Unique Records (shows up as a checkbox on the Advanced Filter window). now, these instructions are easily downloadable from many excel-help websites and i read them over and over again...apparently, i am the only geeky excel user who DIDN'T know how to do this. (but, then again, i have never had a reason to do this). however...i kept doing them over and over and wasn't getting any results so i started to think that a) they didn't work (because, of course, i'm Not Stupid) and b) anyone who read the instructions and thought they worked was stupid. well, i was wrong on both counts. the reason it wasn't working for me is because you have to have an exact duplicate, like the entire row has to match another entire row. whereas, my data was only duplicated in specific columns, namely the first 3. so...to make a long point even more boring, what i did was shortened my data range--you have to do this manually because even if you only select a few columns in your data range, excel changes it to all the columns because excel thinks i'm stupid, too--and THEN used the advanced filter to get rid of duplicates. this gave me a count of the rows in which there were duplicates in the first 3 columns.

okay, trick #2. create a pivot table with only the columns you need, like Member #, Date, & Diagnosis Code and change your sum function to a count function; that requires excel to group any duplicate member #s and give you a count of how many dates and diagnosis they have. you can easily "count" the number of members by seeing how many rows it takes up on your new pivot-table-tab. this is actually much quicker (i think) and a lot more fun!! i love pivot tables!!! i want to be buried with a pivot table. is that possible???

No comments: