+ Reply to Thread
Results 1 to 15 of 15

Auto-fill Address(es) of Cells that meet a manually entered criteria

  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Arrow Auto-fill Address(es) of Cells that meet a manually entered criteria

    Hello all,

    I've been searching around on this forum and others all afternoon and I can't seem to find a solution to my Excel woes.

    I am trying to setup a column that will auto-populate with the cell address of any cells that match the given value within a set of rows and columns. These addresses will then (hopefully) be used to fill in some portions of existing and new formulas used in other parts of the document.

    So, here's the basic layout of what I'm working with: C19:AB65 are filled out with one of the following four values: "Yes", "No", "Sometimes" and "N/A". I want to fill column D with the cell address of each instance of "Yes" (e.g. D1 would return "$A$5", D2 would return "$L$13", etc until all instances of "Yes" are accounted for). Column D will be printed as a reference to which instances were marked as "Yes" and (if I can work it out) to populate portions of other formulas on separate pages of the workbook. The former condition is actually more important in the short run and the latter would only be a handy addition down the road.

    First and foremost, I know there are probably better ways to approach my goals, but I am inheriting the .xls from someone else and would prefer not to redo everything from the ground up.

    I have been seeing a lot of examples combining ADDRESS and MATCH, but these all seem to only return the first instance, min instances or max instances. I need to catch all instances of the given value.

    Anyway, I hope that I have made my issue clear (a day of excel tends to make my head feel a little mushy). I can create an example .xls, but the setup is actually pretty straight-forward, so I'll leave it with my example unless specifically requested.

    Thanks much for any advice!

    I'm using Windows XP and Excel 2007

  2. #2
    Registered User
    Join Date
    03-19-2010
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2016
    Posts
    48

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    This looks like a job for a macro with a for loop, (if you are into macros)...

    By the way, column D seems to be within the range containing your yes/no's. Is that a typo?

  3. #3
    Registered User
    Join Date
    03-19-2010
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2016
    Posts
    48

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    I attached a possible solution. You can "select all" and delete my "dummy" data and paste yours in and it will work for your data.


    This is the code if you know how to use the Visual Basic Editor:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by pichon; 04-14-2011 at 02:39 AM.

  4. #4
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    Quote Originally Posted by pichon View Post
    This looks like a job for a macro with a for loop, (if you are into macros)...

    By the way, column D seems to be within the range containing your yes/no's. Is that a typo?
    Hello pichon, thank you for your response. Yes... Column D was a typo... let's try AD instead .

    I'm about to try out your script, but just wanted to thank you in advance. I'll update in a bit about how it turns out.

    Thanks!

  5. #5
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    Hi Pichon,

    First, thank you for your macro, it works beautifully. However, it isn't exactly the functionality that I am looking for, but I guess I left a few key points out of my request. Let me give you a bit more detail:

    The workbook will actually be filled out by other people, so ideally, I would like to have the workbook automatically populate the cell address without needing to prompt the user (also not needing them to click any buttons or run the macro manually). I could see having a "refresh" button on the page that they could use, but I would prefer it to auto-magically happen on its own.

    Also, I'm sure this is super easy, but my VB knowledge is very minimal; I'd like to get a relative cell address instead of an absolute (AB15 instead of $AB$15).

    Other than that, I can see that the macro is pointing me in the right direction. Thanks for taking the time to help me :-)

  6. #6
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    One more thing. I've been playing around with the Macro and it seems like it is only finding the "yes" values in the C column. Each time I try to run the Macro with new test data, it only returns $C$20, $C$50, etc... nothing from another column. Any insight?

    --Correction: Super noob move - I had Rows 3-18 hidden... D'oh!
    Last edited by fluke2097; 04-14-2011 at 04:00 PM. Reason: I'm a nub

  7. #7
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    One more update: I set up a "refresh" button to run the macro. I think this could work for my purposes as long as we can get rid of the two prompts. I imagine this would be pretty easy, but I tried tinkering with the macro and keep getting a "400" error. The starting cell will always be C19 and the results column will always be AD.

    Also, It looks like the Macro doesn't clear column AD before writing the data. If it could wipe the column before repopulating, that would probably be best in case any of our "yes"es turn in to "no"s.

    Thanks!

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    why are we going down the macro route? without seeing the data it is highly probable this can be done with a helper column and functions
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  9. #9
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    Hi martindwilson,

    To be honest, the only reason I'm headed down the macro route is because that is what pichon suggested :-). If you have any other methods that might steer in another direction, I'd be happy to see them!

    Thanks :-)

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    well a sample workbook would help showing what you need

  11. #11
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    Attached is a quick mock-up of what I'm working with and what I'm looking to accomplish.

    All of the Yes/No/Maybe cells will be filled out by hand. I want the orange cells to display the cell address for each of the Yes conditions. I would like for this list to dynamically update, however here's another little speed bump I ran in to today: There needs to be a "notes" section next to the address generated with the address.

    It would be ideal if these notes could stay in the same row as the cell address that it is related to. With the macro solution that pichon provided, any time that the macro is run to update the list, the notes stay in the same cell, but the list of addresses updates and everything gets mixed up.

    Thanks!
    Attached Files Attached Files

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    i cant see any yes/no/maybe cells

  13. #13
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    Aw geeze... sorry, I uploaded the wrong file. Let's try this one. :-)
    Attached Files Attached Files

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    well im being thick here could you fill out manually on sheet 2 what the results would look like? but at first look i might need alot of helper data so maybe code is the way to go!

  15. #15
    Registered User
    Join Date
    03-03-2011
    Location
    San Francisco, CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Auto-fill Address(es) of Cells that meet a manually entered criteria

    Sorry to have vanished, had to get the doc ready for use on Monday. I wound up just using a manual field that the end-user has to fill out for the cell address. Not the most elegant solution, but it will work for my purposes.

    Thanks for the help, I think I will look over the macro option again when this project is over to see if I can find a way to get the exact results I was looking for.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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