+ Reply to Thread
Results 1 to 3 of 3

Count variable values with conditions

  1. #1
    Registered User
    Join Date
    02-17-2022
    Location
    Spain
    MS-Off Ver
    365 MSO 64 bits
    Posts
    11

    Question Count variable values with conditions

    Hello! Been trying to get this but don't know how... Could you help?

    I attach a image on how data is arranged:
    Captura de pantalla 2022-02-24 092518.png


    What data do I have?

    In the table "A1:C3" I have minimum (MIN) and maximum (MAX) ranges for the X and Y axis (the ranges are variable).

    For each value of "F:F"; there is a variable number of coordinates (X,Y), it goes in two columns in block ("G1:H1")("I1:J1")("K1:L1")... the number of coordinates is variable in each case.

    Currently I know how to calculate for the whole row "G2:BB2" the X and Y values that are within the range (MIN-MAX). The problem I have is that I don't know how to differentiate by blocks, it counts ALL values without conditioning.
    Ideally, it should count the values in the case that the block of "G2" and "H2" are within the ranges defined in the table "A1:C3", and then jump to the next block "I2" and "J2" ... once the row is finished, jump to the next value of "F:F".



    As far as I understand to condition this with formulas is not possible, so my question is:

    Is it possible to automate it with VBA in column "E:E" starting with "E2"?

    Many Thanks!
    Last edited by Ralar; 02-25-2022 at 08:36 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Count variable values with conditions

    The following function might work for you. In the VB Editor, insert a new module (if you don't already have one), then paste this code:
    Please Login or Register  to view this content.
    In E2 you can then put the following formula and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Adjust your range references to suit your specific needs.

  3. #3
    Registered User
    Join Date
    02-17-2022
    Location
    Spain
    MS-Off Ver
    365 MSO 64 bits
    Posts
    11

    Re: Count variable values with conditions

    Wow! Many thanks Paul! That works perfectly!

+ 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] Count unique values with conditions
    By BradleyN1 in forum Excel General
    Replies: 12
    Last Post: 01-11-2022, 10:31 AM
  2. Count textual values with 2 conditions
    By Mister-Vinyl in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-16-2015, 03:49 PM
  3. [SOLVED] Count values with conditions
    By arun.sj in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-25-2014, 10:05 AM
  4. [SOLVED] Count values with conditions
    By bigband1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-16-2014, 11:49 AM
  5. [SOLVED] RE: Count values with conditions
    By Muhammed Rafeek M in forum Excel General
    Replies: 0
    Last Post: 08-21-2006, 06:05 AM
  6. [SOLVED] RE: Count values with conditions
    By Toppers in forum Excel General
    Replies: 1
    Last Post: 08-21-2006, 06:05 AM
  7. [SOLVED] Re: Count values with conditions
    By Bob Phillips in forum Excel General
    Replies: 0
    Last Post: 08-21-2006, 06:05 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