+ Reply to Thread
Results 1 to 5 of 5

Why cant i pass an integer to the filter search criteria???????????

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    83

    Why cant i pass an integer to the filter search criteria???????????

    Im using this code:

    Please Login or Register  to view this content.

    the seach criteria is either a string or a number. i want to beable to search for the criteria any where within the cells. The string works fine, but when i use a number it wont work???

    Ive tried so many variations and even set it as just a straight number and it still wont work!!!!

    help appreciated!

  2. #2
    Registered User
    Join Date
    05-31-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    83

    Re: Why cant i pass an integer to the filter search criteria???????????

    Ok so ive removed the Isnumeric section and that applies the filter to a column that contains strings, wether you pass a number or a strinf.

    How ever when i apply a filter with a number to a column containg number it still wont work. ie filter column with numbers containing 20.

    Ive realised that if i put equals 20 it will work, but wont relate contains 20 to a cell with 20 in!!


    hope that makes sense! please help

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Why cant i pass an integer to the filter search criteria???????????

    Hi,

    This would be easier if we had the workbook in question and some specific examples to test.
    However in the absence of a workbook don't forget that you can always convert a number to be a string by wrapping it in a Cstr(MyNumber). And of course vice versa, convert a string to a number with Clng(MyNumber). Using Cstr() on a string of course leaves the string as it is.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    05-31-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    83

    Re: Why cant i pass an integer to the filter search criteria???????????

    Richard,

    it works when im searching for "20" within a string, however when searching for "20" within a cell containg a number it doesnt work! ie it wont filter all the 20's or numbers like 200 or 220???

    Thanks for the help

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: Why cant i pass an integer to the filter search criteria???????????

    It shouldn't work manually either if your data are actual numbers. 'Contains' only works on text data.
    Everyone who confuses correlation and causation ends up dead.

+ 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. Search for integer & decimals in set range
    By beenbee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-17-2014, 07:58 AM
  2. Index/Match Formulas - Search/Filter Based on Specific Criteria
    By Christopher.Belanger in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-10-2012, 08:42 AM
  3. How to Filter Detail tab based on Search criteria from another tab
    By CharterJP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2010, 07:08 PM
  4. Pass cell content into a filter
    By jtan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2009, 09:29 PM
  5. Using advanced filter to search for criteria in a list
    By Potatosalad2 in forum Excel General
    Replies: 1
    Last Post: 06-08-2005, 11:05 AM

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