+ Reply to Thread
Results 1 to 4 of 4

Wildcard problem in Excel 2007

  1. #1
    Registered User
    Join Date
    06-22-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Wildcard problem in Excel 2007

    Hi, I'm a beginner in Excel and I'm trying out some wildcard usage in Excel but I have run into some problems. Hope you guys can help me with it. Thanks!

    Okay, the problem is that I have the following info in the cells A1:A4:
    434
    454
    31
    122

    Now in the next cell A5, I type the function =countif(A1:A4,"4?4"). But I get a number 0 rather than 2.

    However when I change the cells A1:A4 to:
    A3A
    A5A
    31
    122

    and i type =countif(A1:A4,"A?A"), the function worked and give me a result of 2.

    How can I rectify this problem? Why does it work for letters and not numbers?

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Wildcard problem in Excel 2007

    If the A1:A4 are formatted as Text prior to data entry then it will work.

    The use of wildcard in COUNTIF means it looks for text strings... it follows that if the values are numbers (not text) the result will be 0.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Wildcard problem in Excel 2007

    Wildcards won't work with numeric data [as Donkeyote says]. A1:A4 has to be text formatted for your COUNTIF formula to work, otherwise, if data is all numeric you could use this formula

    =SUMPRODUCT((INT(A1:A4/100)=4)*(MOD(A1:A4,10)=4))

    or for text and/or numeric values in the range

    =SUMPRODUCT(ISNUMBER(SEARCH("4?4",A1:A4))*(LEN(A1:A4)=3))
    Last edited by daddylonglegs; 06-22-2010 at 04:45 AM.
    Audere est facere

  4. #4
    Registered User
    Join Date
    06-22-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Wildcard problem in Excel 2007

    Oh, alright. That helped a lot. Thanks.

+ 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