+ Reply to Thread
Results 1 to 7 of 7

Macro to search and return rows of data when a number of conditions are met

  1. #1
    Registered User
    Join Date
    04-23-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    50

    Macro to search and return rows of data when a number of conditions are met

    Hi group,

    I have a dataset that has 12 columns in sheet 2. column A has property addresses. The other 11 have corresponding expenses categorized: i.e. landscaping, electrical, plumbing, etc.

    In sheet 1 I would like to have a drop down menu where if I select say landscaping (say cell A1) and have a corresponding IF function (cell A2), the macro will display all rows where the value is true.

    Above my columns in sheet 2 I have an average spent for each category. So when I select landscaping in the drop down menu, cell A2 would simply switch to the average based on this IF function

    I would want the macro to retrieve all rows with homes greater than equal to the value in A2 below these cells. .

    I hope this makes sense.

    Any and all help is appreciated.

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

    Re: Macro to search and return rows of data when a number of conditions are met

    Hi Chavez,

    I've done what I think you want using the Advanced Filter tool in Excel. See if you can understand the attached that answered a previous question.

    Advanced Filter using Street addresses.xlsx

    I hope this helps.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    04-23-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Macro to search and return rows of data when a number of conditions are met

    Hi Marvin, and thank you for responding.

    I dont have much experience with advanced filters, but the issue i see with using this feature is that i dont want all 12 columns in my filtered search. Looking at the filtered search criteria, i have to have the same amount of columns - if that makes sense.

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

    Re: Macro to search and return rows of data when a number of conditions are met

    Hi Chavez,

    I think its time to ask for a sample file and show us what you have and want as a result. If we can see that, it might make more sense and you'd get a better answer.

    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.

  5. #5
    Registered User
    Join Date
    04-23-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Macro to search and return rows of data when a number of conditions are met

    Hi Marvin, and again thank you for your assistance.

    I have attached a sample worksheet. In essence, I have 24 columns, one column for an expense item, and a column next to it with
    corresponding z-score.

    I am looking to extract those properties that exceed a parameter in two or more expense codes. (i.e. lawn care>.23, and repairs>.23 show we the property.)
    Attached Files Attached Files

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Macro to search and return rows of data when a number of conditions are met

    Give this a try

    Please Login or Register  to view this content.
    Last edited by mike7952; 01-01-2018 at 01:11 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  7. #7
    Registered User
    Join Date
    04-23-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Macro to search and return rows of data when a number of conditions are met

    This is brilliant, Mike; thank you!

    Now, what if I wanted a drop down menu for category and a z-score parameter? i.e., I can switch the parameter to only maintenance, and a z-score greater than my choosing and hit run.

    I imagine B1 to be drop down list and C1 to manually input a score (>.23). Also, is there a way to make this an IF formula, ie, IF A1 = ALL, it just looks for those that exceeded the zscore parameter, if blank, it defaults to the drop down category?

    I hope this is not too complicated.

+ 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. want to search particular number string from all the number data - Using Macro
    By arpanpatil2000 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-23-2015, 06:49 AM
  2. [SOLVED] Macro to search all sheets and return corresponding rows of searched value
    By amar05 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2013, 01:56 AM
  3. Search in table a number with conditions
    By XCEL_NOVICE in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-07-2013, 01:23 PM
  4. Complecate Macro to search value of intersect Rows and Columns with conditions
    By hassan khansa in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-26-2013, 11:00 AM
  5. Replies: 9
    Last Post: 09-13-2012, 03:44 PM
  6. Macro request: Create and Search two sets; return number of duplicates
    By Breex243 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2010, 05:46 PM
  7. [SOLVED] Search for a number in a table and return data of a specific cell
    By Karaman in forum Excel General
    Replies: 4
    Last Post: 06-30-2006, 10:50 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