+ Reply to Thread
Results 1 to 4 of 4

VBA to count "[specific text]" after defined date in adjacent column

  1. #1
    Registered User
    Join Date
    02-01-2021
    Location
    Birmingham
    MS-Off Ver
    2016
    Posts
    25

    VBA to count "[specific text]" after defined date in adjacent column

    Hello everyone,
    I have attached an example database where I have repeats of test outcomes ("normal" or "abnormal") inputted alongside the test date over different time periods per person. At the end of each test I have counts of the total number of tests as well as the totals of the "normal" and "abnormal" outcomes.

    2 variables have been introduced at different dates throughout the testing time period. These are recorded in the table after the test outcomes section, with space for counts of the number of tests as well as the number of normal/abnormal outcomes after the DoV (Date of Variable). I have got a formula to count the total number of tests carried out after the DoV however I am stuck on how to count the (ab)normal outcomes in the test ranges after the DoV.

    I have tried writing a UDF for this purpose (attached in the example sheet) however the error "Sub or Function not defined" comes up and I can't figure out why.
    Any ideas on why this is or suggestions on another way to achieve what I'm after??

    P.S. I have highlighted the column headers where these calculations are needed in red for ease.
    P.P.S. I have included 2 tests that are laid out slightly differently in the worksheet to give an example of the layouts I am working with.
    Attached Files Attached Files
    Last edited by lilybickel; 03-22-2021 at 07:52 AM. Reason: solved

  2. #2
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    361

    Re: VBA to count "[specific text]" after defined date in adjacent column

    give this a try

    Please Login or Register  to view this content.
    i did not check your logic
    Last edited by Joske920; 03-19-2021 at 11:58 AM.
    Please be as complete as possible in your asking so it may save use all the time to rework the solution because you didn't give all the requirements. If you have a layout in mind please work it out first so we can adapt our solution to it. Thanks.
    If you have been helped, maybe you could click the *

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    18,187

    Re: VBA to count "[specific text]" after defined date in adjacent column

    Get rid of Value()
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-01-2021
    Location
    Birmingham
    MS-Off Ver
    2016
    Posts
    25

    Re: VBA to count "[specific text]" after defined date in adjacent column

    That works Thank you

+ 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. Replies: 6
    Last Post: 07-16-2017, 09:06 AM
  2. Replies: 6
    Last Post: 08-25-2016, 02:24 AM
  3. Find a word "screenshot" and print value "yes" in adjacent Column
    By prat123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2015, 03:04 PM
  4. [SOLVED] :confused: Auto pick "specific data" and put it in "specific cells" with date
    By pipsmultan in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 08-27-2014, 03:31 AM
  5. Find "TEXT 1" in a range and enter "TEXT 2" in the adjacent cell
    By madreag in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-28-2013, 05:34 PM
  6. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  7. Replies: 1
    Last Post: 07-16-2010, 02:44 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