+ Reply to Thread
Results 1 to 5 of 5

Passing arguments in COUNTIF function

  1. #1
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Passing arguments in COUNTIF function

    Hi,

    I need to use countif function for column A15 to C15 to count the number of occurrences using macro but the following code is not working
    I have data in 3 columns (A-C) up to 15 rows.

    Please Login or Register  to view this content.
    x and z values will change project to project so I need to pass this as an argument.

    Please help me.
    Last edited by abduljaleel.mca; 02-19-2013 at 11:34 AM. Reason: Use code tags

  2. #2
    Registered User
    Join Date
    01-25-2013
    Location
    Finland
    MS-Off Ver
    Excel 2011
    Posts
    18

    Re: Passing arguments in COUNTIF function

    How about:
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: Passing arguments in COUNTIF function

    Hi,

    Thanks for your reply.

    Now I am getting an error - "error 13 type mismatch" after using your code.

  4. #4
    Registered User
    Join Date
    01-25-2013
    Location
    Finland
    MS-Off Ver
    Excel 2011
    Posts
    18

    Re: Passing arguments in COUNTIF function

    Sorry, you need to convert numbers to strings. Try this:
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: Passing arguments in COUNTIF function

    Hi,

    I used your first code with some little modification and it is working fine now. Please see below.

    ActiveCell.FormulaR1C1 = "=COUNTIF(R1C1:R" & x & "C" & Z & "," & i & ")"

    Thank you so much for your help.

+ 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