+ Reply to Thread
Results 1 to 7 of 7

Modify COUNTIF to make it case sensitive

  1. #1
    Registered User
    Join Date
    06-25-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    76

    Modify COUNTIF to make it case sensitive

    i am looping through fields A and C to get duplicates:
    'concatenate the fields for which duplicate is to be checked
    For i = 2 To lastrownum
    data_sheet.Cells(4, 1) = data_sheet.Cells(1, field1) & data_sheet.Cells(3, field2)
    Next i

    'list the duplicates
    For j = 2 To lastrownum
    If WorksheetFunction.CountIf(Range("D2:D" & lastrownum), Range("D" & j)) > 1 Then
    data_sheet.Cells(5, 2) = "Duplicate"
    End If
    Next j
    But i want to make it case sensitive. pls help

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Modify COUNTIF to make it case sensistive

    By default VBA is case sensitive. DonkeyOte said me than when I tried to do same thing ...
    Try to include EXACT function into COUNTIF....
    Last edited by contaminated; 02-08-2010 at 04:07 AM.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Registered User
    Join Date
    06-25-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Modify COUNTIF to make it case sensistive

    yah but this is using an excel formula COUNTIF which is making it case insensitive. I want to make it case sensitive

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

    Re: Modify COUNTIF to make it case sensistive

    If you wanted to use Worksheet Functions to do this you would need to use an alternative formula.

    Looking at your code, perhaps:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Modify COUNTIF to make it case sensistive

    This test is case sensitive
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Registered User
    Join Date
    06-25-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Modify COUNTIF to make it case sensistive

    thanks. can you pls explain how it works? also, it is listing blank rows as well for duplicates which i would to ignore.
    Quote Originally Posted by mikerickson View Post
    This test is case sensitive
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-10-2010
    Location
    Malmo, Sweden
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Modify COUNTIF to make it case sensistive

    as for blank cells add this to your if condition:

    Please Login or Register  to view this content.

+ 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