+ Reply to Thread
Results 1 to 10 of 10

Get cells value based on a criteria

  1. #1
    Forum Contributor
    Join Date
    07-08-2012
    Location
    beirut
    MS-Off Ver
    Excel 2010
    Posts
    102

    Get cells value based on a criteria

    Hi, I need a VBA code to look in sheet "All" and find all cells in column A that are equal to the type specified in sheet1, and then copy their corresponding value and profit in columns B and C. I provided a sample of a small data, but my list would be like 100000 entries, so the code should not stop at a fix row number (in this case A9), but instead at the last filled cell in column A. Thanks in advance.
    Attached Files Attached Files
    Last edited by chiidzzz; 09-19-2017 at 06:21 PM.

  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: Get cells value based on a criteria

    Not sure this is what you want but in Sheet1:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    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 Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Get cells value based on a criteria

    Hi chiidzzz,

    Find the attached that has these features:
    1. A Dynamic Named Range on the All Tab that will grow to the size of your data set.
    2. A Advanced Filter of the AllData to work using a Macro (I simply recorded a macro)
    3. On changing the Sheet1 cell of A2 it will fire the advanced filter macro.

    I think this is what you want. Change the yellow cell value and see what happens. Look at the VBA behind the sheet and in the module to see it work.

    On Dropdown Change Adv Filter.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    07-08-2012
    Location
    beirut
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Get cells value based on a criteria

    Yes that's it thank you

  5. #5
    Forum Contributor
    Join Date
    07-08-2012
    Location
    beirut
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Get cells value based on a criteria

    Thanks Marvin

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

    Re: Get cells value based on a criteria

    I've edited the program and I'll post it if you're interested.

  7. #7
    Forum Contributor
    Join Date
    07-08-2012
    Location
    beirut
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Get cells value based on a criteria

    Thanks xladept, what you've done works great, and this is what I need. however, my real columns location are different than the sample provided.
    (they are now in sheet 3 of the sample)
    The "type" is in column L, "value" is in column P, and "profit" is in column Q.
    And all the other columns contain data.
    What should I change in your code?
    Attached Files Attached Files
    Last edited by chiidzzz; 09-20-2017 at 10:09 AM.

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

    Re: Get cells value based on a criteria

    You're welcome and thanks for the rep!

    The new format isn't as convenient - but:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    07-08-2012
    Location
    beirut
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Get cells value based on a criteria

    Thank you, much much appreciated

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

    Re: Get cells value based on a criteria

    You're welcome!

+ 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. Combine text from multiple cells based on criteria from other cells
    By t2cool in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-07-2017, 12:03 PM
  2. [SOLVED] Lookup in a range of cells and extracting cells based on values and criteria
    By A_W in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-03-2016, 05:34 AM
  3. [SOLVED] Returning multiple cells based on criteria of other cells
    By paulstuartbullock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-19-2016, 06:19 PM
  4. [SOLVED] Adding specific text to cells based on another cells data criteria
    By JohnnyBoyxxx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-26-2015, 02:08 PM
  5. Replies: 4
    Last Post: 06-13-2014, 07:08 PM
  6. [SOLVED] Formula Needed to count a range of cells based on criteria in 2 other cells
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-01-2013, 04:06 PM
  7. Replies: 2
    Last Post: 06-24-2010, 04:53 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