+ Reply to Thread
Results 1 to 3 of 3

Countif code returning "TRUE" instead of a value

  1. #1
    Registered User
    Join Date
    09-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Countif code returning "TRUE" instead of a value

    I'm looking to use a countif function on a selection of cells. My code is:

    Please Login or Register  to view this content.
    and it returns "True" after I run the macro, when I want the actual count. (Let's assume D7:D184 is my selection address, and B3 contains the criteria value) I can type:

    Please Login or Register  to view this content.
    into the Excel spreadsheet, and it returns the actual count. What am I not understanding, and how can I make my VBA code return an integer instead of "TRUE"?

    I appreciate the help.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Countif code returning "TRUE" instead of a value

    welcome to the forum, tchaik1812. try:
    Please Login or Register  to view this content.
    the whole formula there is a text. so you have to separate the formula & the variable (Selection.Address). the double quotes have to be doubled ("">="") when you use it as a formula in VBA. otherwise, it will think that you're ending the code.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    09-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Countif code returning "TRUE" instead of a value

    benishiryo,

    Thank you so much. I've been struggling with this for hours. Since I posted the thread, I realized I needed the double quotes around the >= portion of the code, but wasn't putting quotation marks around & Selection.Address &.

    Thanks again.

+ 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. [SOLVED] Find the last "TRUE" in a range returning result tells me the row number where it is
    By nenadmail in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-11-2012, 10:40 AM
  2. Finding Occurences of "True" and returning the Correlating Description
    By braydon16 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-23-2011, 03:56 PM
  3. Replies: 5
    Last Post: 10-12-2010, 06:46 AM
  4. Replies: 7
    Last Post: 05-13-2006, 05:02 PM
  5. [SOLVED] Leave cell data (IF(ISNA(VLOOKUP) is TRUE instead of returning blank (" ") or #NA
    By joisimha@gmail.com in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-27-2005, 11:05 AM

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