+ Reply to Thread
Results 1 to 7 of 7

Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Question Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    Hello All,

    Is it possible to store row numbers of cells for which COUNTIFS criteria's meet, into an array ..?

    If its possible, then is it possible to create an array to store values of these Row Numbers and constant columns numbers..?

    In real scenario, i want to pull values in column 4 into array, but the row number is based on countifs criteria.

    Request experts to advise.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    With a dictionary you can get keys and their items.

    Attach a sample workbook. 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.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    A sample workbook would speed things up.
    Questions:
    1) What are your criteria? Please show your formula.
    2) Do you want the Row numbers in the array, or the values of the cells?
    3) Will there be gaps between "TRUE" cells, or is it one contiguous block (area)?
    Last edited by leelnich; 07-08-2017 at 12:14 PM.

  4. #4
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    1) What are your criteria? Please show your formula.
    Refer Column B:B.. Values must be stored in array only if counts are greater than 1.
    2) Do you want the Row numbers in the array, or the values of the cells?
    I want values to stored in an array--Column D:D values.. later i need to loop through this array and check for specific values.
    3) Will there be gaps between "TRUE" cells, or is it one contiguous block (area)?
    No Gaps

    Please refer attached sample file
    Attached Files Attached Files
    Last edited by mchilapur; 07-09-2017 at 01:41 AM.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    I put them under your table - try:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    Thanks for your response.. But your code was not addressing my question..
    No problem .. I appreciate your time and support provided. Will tag this thread as "SOLVED"

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Excel VBA to store cell row numbers into an array if COUNTIFS criteria's is met

    Are you sure that your problem was not addressed?

    Try this:

    Please Login or Register  to view this content.
    And you will see that the array "Dic" was, indeed, stored - at least as long as the book is up

+ 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] Store rows numbers in an array by criteria
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2017, 02:18 PM
  2. Countifs on an Array Range using multiple criteria in an Array
    By Mysore in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-12-2016, 04:39 PM
  3. [SOLVED] Dynamic Changing Data, Based on Criteria Store in Array, Sum array and store in Cell
    By penbeacho in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-28-2015, 10:31 AM
  4. Countifs multiple criteria array
    By lamdl in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-20-2014, 09:18 PM
  5. Store current COUNTIFS value in each row in MS-Excel?
    By silvercover in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-06-2014, 07:36 AM
  6. [SOLVED] Using cell numbers to replace numerals in COUNTIFS criteria
    By tsig in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2013, 02:03 AM
  7. Replies: 2
    Last Post: 11-12-2009, 10:31 PM

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