+ Reply to Thread
Results 1 to 3 of 3

Counta & Countifs in VBA

  1. #1
    Registered User
    Join Date
    09-01-2014
    Location
    England
    MS-Off Ver
    2013
    Posts
    6

    Exclamation Counta & Countifs in VBA

    Hello all,

    I love using excel but really struggle with VBA - very hard to teach yourself - I am in the process of it.

    Anyway, would anyone please be able to re-write the below formulas into VBA so I can assign and run them all with one button click.

    Also can you please let me know the best place to find the info to continue my learning.

    =COUNTA(Deviations!$F$8:$F$2200)
    =COUNTIFS(Deviations!$J$8:$J$2100,"<16",Deviations!$F$8:$F$2100,"<>")
    =COUNTIFS(Deviations!$J$8:$J$2100,"<25",Deviations!$F$8:$F$2100,"<>")-J11
    =J10-J11-J12

    For the first I have managed to come up with this that seems to work, no idea what to do next though.

    Please Login or Register  to view this content.
    Thank you so much in advance, this has been driving me crazy for days no so thought I should ask for some help!!
    Last edited by davesexcel; 06-23-2020 at 11:35 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Counta & Countifs in VBA

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this !


    As a VBA beginner starter :

    PHP Code: 
    Sub Demo1()
        [
    H10] = [COUNTA(Deviations!$F$8:$F$2200)]
        [
    H11] = [COUNTIFS(Deviations!$J$8:$J$2100,"<16",Deviations!$F$8:$F$2100,"<>")]
        [
    H12] = [COUNTIFS(Deviations!$J$8:$J$2100,"<25",Deviations!$F$8:$F$2100,"<>")-J11]
        [
    H13] = [J10-J11-J12]
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

+ 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: 03-19-2019, 09:14 PM
  2. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  3. [SOLVED] Putting COUNTA in COUNTIFS?
    By jonathan.haynes in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2013, 11:08 AM
  4. COUNTIFS OR...multiple countifs without duplication in the numbers
    By HooligaD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2012, 09:53 AM
  5. [SOLVED] Using COUNTA and COUNTIFS in the same formula
    By dogguy09 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-14-2012, 02:52 PM
  6. Sumif, sumifs, counta, countifs??
    By 1.zer0 in forum Excel General
    Replies: 3
    Last Post: 01-14-2012, 06:18 AM
  7. Replies: 0
    Last Post: 12-16-2011, 09:01 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