+ Reply to Thread
Results 1 to 13 of 13

Extract values if condition is satisfied

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Extract values if condition is satisfied

    Would like to use formula to extract values in column A, B, D, F and G if the dropdown conditions in J2 and K2 are met (expected outcome is in green color). See sample file.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract values if condition is satisfied

    I know you mentioned a formula but have you considered using a Pivot Table? And if so why do you want a formula rather than a PT?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Extract values if condition is satisfied

    Hi bjnockle,

    Find the attached that has some VBA code behind the worksheet and in a module. If you change any of the Orange values (using validation) it triggers the event code behind the worksheet. This code calls the "AdvFilter" code that does an Advanced Filter and gives what you have selected in orange. If you want all then select a Blank instead or a word (Dell or Acer).

    See if this works for you.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values if condition is satisfied

    Richard Buttrey: Thanks for the response. I would like to accomplish this task by formula.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Extract values if condition is satisfied

    Like Richard, I am curious why a formulaic solution is needed over a Pivot Table. Once the PT is set up, it is only a case of choosing your criteria and it automatically updates. Help us to understand your thought process on this issue.

    See attached for PT results.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values if condition is satisfied

    Marvin: Great! I am trying to stay clear of VBA. I would prefer a formula to accomplish this task in case there is need to modify the data. Not a VBA expert to troubleshoot issues/modifications.

  7. #7
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Extract values if condition is satisfied

    Quote Originally Posted by bjnockle View Post
    I would like to accomplish this task by formula.
    The obvious question is why?

    I'm with the others on this. Listing only those items that match the criteria could probably be done with array formulas (I'm not an expert with array formulas so I wouldn't be able to help with that). Alternatively you could get all the data that matches the criteria without an array formula, but you would have to list all the products and then have blank rows for those products that don't meet the criteria. A pivot table will give you what you need quickly and easily.
    Please add reputation by clicking on the * if I have helped.
    Please mark the thread SOLVED if your issue has been resolved.
    Thanks, Glenn.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Extract values if condition is satisfied

    Hey Alan,

    He could even use Slicers to get his answer and not even need dropdowns.

    No Formulas needed
    Attached Files Attached Files

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Extract values if condition is satisfied

    Marvin,

    I concur. Thanks for adding it.

    Alan

  10. #10
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values if condition is satisfied

    MarvinP: Great suggestion. I am familiar with both PT and slicers functionality in Excel. however, would like to pull the values using a formula. Thanks.

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract values if condition is satisfied

    Quote Originally Posted by bjnockle View Post
    MarvinP: Great suggestion. I am familiar with both PT and slicers functionality in Excel. however, would like to pull the values using a formula. Thanks.
    Hi,

    I don't see where you have enlightened us as to why you prefer a formula other than to say " I would prefer a formula to accomplish this task in case there is need to modify the data."

    I can't honestly see why you should consider expanding or modifying data would be a problem for a Pivot Table.
    First of all if you are modifying data, (e.g. general layout or relationships) then it's more than likely that any formula would also need modifying itself in any case.
    If you're expanding data by adding new records/rows then a dynamic formula that covers the data range will adjust automatically and the PT would then be based on this dynamic range name.

    I'm struggling to really understand why you appear fixated on a formula.

  12. #12
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Extract values if condition is satisfied

    Richard Buttrey: Using PT would mean the user will have to manually refresh or use VBA code to auto trigger refresh. Thanks

  13. #13
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract values if condition is satisfied

    Quote Originally Posted by bjnockle View Post
    Richard Buttrey: Using PT would mean the user will have to manually refresh or use VBA code to auto trigger refresh. Thanks
    Not necessarily. Personally I always use a Sheet Activate macro event on the Pivot Table sheet which automatically refreshes the pivot table and I can forget all about needing to do it manually.

+ 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: 2
    Last Post: 08-01-2011, 03:22 PM
  2. Replies: 8
    Last Post: 05-06-2011, 08:25 AM
  3. Lock Cell/s if condition satisfied.
    By cminoza in forum Excel General
    Replies: 1
    Last Post: 10-07-2009, 09:21 AM
  4. [SOLVED] Deleting columns if condition is satisfied
    By kent-dk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2006, 06:25 AM
  5. Replies: 0
    Last Post: 01-11-2006, 07:31 AM

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