+ Reply to Thread
Results 1 to 9 of 9

How to filter in a specific range in Excel 2010

  1. #1
    Registered User
    Join Date
    06-08-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    50

    How to filter in a specific range in Excel 2010

    Hello guys,

    I was very surprised today when I found that a small application developed in Excel 2003 doesn't work properly under Excel 2010. Shortly, I have a column with 100 rows and I want to filter first 50 rows only. In Excel 2003 this function works very well for a specific range but in Excel 2010 I get each time a filter for ALL rows...Because I never tested Excel 2010 before I would appreciate any comment about this issue. Below is the function
    Please Login or Register  to view this content.
    Thank you in advance.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,284

    Re: How to filter in a specific range in Excel 2010

    Hi nemo66ro,

    Have you tried inserting a blank row at row 51? This would tell Excel that the last row of your table is 50.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-08-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: How to filter in a specific range in Excel 2010

    Hi Marvin,
    Do you consider this approach a good programming practice ? This would mean to insert, delete, maybe storing rows each time I call a filter in a table...It doesn't seem a convenient way. Thank you.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,284

    Re: How to filter in a specific range in Excel 2010

    Hi,

    So I'm seeing you have this table of lots of rows. You want to sort the top 50 rows. I'm thinking your lots of rows grow by time or something? Why don't you sort all the rows by what your criteria is first and then by time second. This would let the top 50 move to the top.

    Depending on the problem there are lots of ways to accomplish the problem also. If you had a helper row showing the row number you could do an advanced filter to filter to another sheet or place in the same sheet the data in the top 50 rows.

    Now - you are asking for a VBA solution, I understand that. My answer is to always suggest the least complicated method. Because you are having problems with the VBA code in a 9 year old versions, I'd suggest posting a sample workbook and let some guru's look at the exact problem and suggest a non-vba answer. BTW - in newer versions of Excel there is more robust features in TABLES of data. In 2003 they called them lists.
    Look at http://office.microsoft.com/en-us/ex...010048546.aspx for tables only.
    Also did you know that you can view the top 10 or 50 or 100 using Pivot Tables? http://www.contextures.com/excel-piv...ers-top10.html

    The information you may want might be handled easily with a non-vba solution.

    Sorry for the rant but you want someone to fix you VBA code that doesn't work because you've upgraded your version from 2003 to 2010. A lot of things have changed since then. If you supply the workbook with code we could look at it.

    Because you have 2010 you might want to see what is new in it and possibly avoid VBA. Look at http://blogs.office.com/b/microsoft-...xcel-2010.aspx

  5. #5
    Registered User
    Join Date
    06-08-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: How to filter in a specific range in Excel 2010

    Hi Marvin,
    I have some doubts that your remark could be a common courtsey...
    "you want someone to fix you VBA code that doesn'twork because you've upgraded your version from 2003 to 2010"
    As I know I have requested some details about an issue (Filter function) and it wasn't addressed to a customer service. On the other hand, we should consider Excel 2010 a modern tool, more performant than 2003 version.
    I thought, I have all reasons to fell like a driver in a fancy car but if something goes wrong with a feature is not a pleasure to receive suggestions for bicycle or pedestrian as "the least complicated method". Of course that entire Excel might be handled with any IDE, but I wonder why this function has changed the behaviour in the 2010 version. Normally, an upgrade should mean a changing from good to better...
    Shortly, I have no upgrade to do but some colleagues use an application developed in Excel 2003 and in this version a filter works as below :
    Capture.GIF
    As you will see in attachment if we try to filter by "John" we will have on the Range("A1:A10") 2 cases (the WorkFunction.CountIf is 2...). Now, if we try to run the same code in Excel2010 we will have 4 cases filtered even the count is 2...Practically, instead of a Range is filtered the entire column...
    Capture2.GIF
    Thank you in advance for any possible explanation.
    Attached Files Attached Files
    Last edited by nemo66ro; 12-04-2012 at 09:09 AM.

  6. #6
    Registered User
    Join Date
    06-08-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: How to filter in a specific range in Excel 2010

    Hello VB friends,

    I have just got back from a working trip to UK and it seems no experienced guy provided a solution to my thread. As usually, let us manage our own resources....After a few attempts I have succeeded to create a function that doesn't return any value but is trying to simulate the Excel 2003 filter.
    That filter behaviour - which takes into account the values from a specific range only and not the entire column... - has been successfully substituted using the "hidden" property. Just keep in mind that this function was adapted to my needs so that each time the first row is dedicated to the header row.
    Below it is a small example where are filtered all cases which are different from "Erwin", on the "A" column but taking into account only the first 10 rows.
    Please Login or Register  to view this content.
    The result, as you can see attached, is as we expected. myFilter.GIF.
    Have you all a good day !

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

    Re: How to filter in a specific range in Excel 2010

    I agree that it looks like a bug-although I reckon microsoft will say it's a feature-but I can't really see why it causes you a problem in code since you know what range you want to process anyway?
    Josie

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

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,284

    Re: How to filter in a specific range in Excel 2010

    Hi -

    I guess this is an unhappy OP where things changed in 2010 Excel when it worked like he wanted in 2003. I'm not exactly sure but I believe the answer lies with new features to Excel Tables in 2010. See - http://www.databison.com/index.php/t...ulas-in-excel/

    This question revolves around having an AUTOFILTER established in a table and wanting it to act on only a portion of the table. I guess with the new features of 2010 tables the assumption was an Autofilter then should apply to the entire table. If the user didn't want the entire table filtered they shouldn't use the autofilter button!??? I don't consider this a downgrade of an excel function but a simple more specific definition of what autofilters do and what assumptions they carry with them.

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

    Re: How to filter in a specific range in Excel 2010

    but this is not a table. it's just a range. if it were a table I'd agree

+ 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.6.0 RC 1