+ Reply to Thread
Results 1 to 7 of 7

Extracting conditional data from different sheet

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Penang
    MS-Off Ver
    Excel 2007
    Posts
    4

    Lightbulb Extracting conditional data from different sheet

    Hi,


    I'm not sure which sub-forum to post my queries, so I'm posting at 2 sub-forums, Kindly guide if possible.

    I need help with the following.
    I have 2 worksheets, Preapproved and People
    In Preapproved, there is table where each Role being defined with the relevant Responsibility.

    What I am trying to achieve here is in the second sheet - People.
    1.) Create a dropdown box for Role based from Preapproved sheets Role
    2.) Automate the population of the Responsibility in People sheet once the user have selected the right Role.


    Together I'm attaching the sample excel sheet > MFG NewHire IT Doc.xlsx

    Thanks in Advance.
    Let me know if I have posted in the wrong sub-forum
    Attached Files Attached Files

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Extracting conditional data from different sheet

    Okay, Try the attached, I would post the formulas, but the one is pretty big, it allows for 20 responsibilities
    I would probably make that a named formula normally, or use VBA for the concatenation, but you need to see what is involved in putting a lot of values into one cell...and what is worse is trying to extract it, so PLEASE think about this style of returned info, before you decide it is what you NEED....

    Hope this helps
    Attached Files Attached Files
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Registered User
    Join Date
    03-19-2013
    Location
    Penang
    MS-Off Ver
    Excel 2007
    Posts
    4

    Lightbulb Re: Extracting conditional data from different sheet

    Hi Dredwolf,

    Thanks, indeed this helps a lot in automating certain process and eliminating human error. Couple of things that might help make this sheet perfect.

    1.) Moving forward how do I add more Role & Responsibility to the existing "Preparroved" sheet. Where and what should I modify.
    2.) In "People" sheet, I would like to lock column "Responsibility" and make it non editable. As its being auto populated based on "Role"


    Based on the formula, I'm assuming it can only display max of 20 responsibilty and as you said its preety long formula. I would be facing difficulities maintaining it in a long term. Based on your expertise what would be the best approach to achieve the desired result other than sol1.xlsx

    Thanks again for all your effort and time


    Thanks
    Ravan

  4. #4
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Extracting conditional data from different sheet

    Okay I think I've got it worked out..my VBA is not the greatest, so it took a lot of searching to get the proper format for the second bit of code below
    In the example I've added 2 UDFS, and a custom sub
    (Note- I've placed all 3 in the same module)
    the First UDF:
    Please Login or Register  to view this content.
    As you can see, I "borrowed" some code that Andrew-R made from here :http://www.excelforum.com/excel-form...59#post3097959 (post #3)
    This handles the concatenation of all the responsibilities, using the 'refers to' part of the named range specified by the drop down

    the second UDF & the sub: (the sub calls this UDF, so I have grouped them together here)
    Please Login or Register  to view this content.
    I then Inserted a Command button and in the Assign Macro I used CreateNRs
    This creates the list of named ranges to use
    (the red D4:D301 is what needs to be changed if you wish to change the size of your jobs list beyond what I have allowed for in the Attachment)

    (for use of the code outside the sample)
    To use these, Macros must be enabled, then
    Hit Alt-F11 to get to VBA editor, Insert-->Module, paste the code into the module, save and close editor

    On 'preapproved' sheet
    In C4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In D4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag both down to Row 301 (or where you decide to end input)
    In E4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    drag down as far as needed (enough to cover all the Roles expected at least )

    (again, red 301's need to be changed if you want to extend the list past there)
    Need 1 defined Name Range : Roles refers to: =OFFSET(preapproved!$E$4,,,SUMPRODUCT(--(preapproved!$E$4:$E$301<>"")))
    the red 301 here just needs to be large enough to cover the range of the formula in Column E

    On 'People' Sheet
    In G4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    drag down to bottom of table (G44)

    This should automate the process pretty well for you, you just need to enter the data in the A & B columns of 'preapproved' and hit the Create Lists Button

    For the keeping people from editing column G, I selected the entire sheet, Format Cells, Protection...unchecked the Locked option
    Then I selected the cells from G4-G44, Format Cells, Protection...re-checked the locked option, Locked the sheet and allowed following allow options, select locked cells (so that you can see the formula),select unlocked cells,use auto-filter (so your filters would still work )
    I did something similar on the 'preapproved' sheet to keep the formulas in columns C,D & E from being changed or broken
    The sheets are not password protected, so you can un-protect them simply by hittng Un-Protect Sheet on the review tab

    See attached

    Hope this helps
    Attached Files Attached Files

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Extracting conditional data from different sheet

    I guess I may have exceeded the post size limit on last post...It would not let me add the following

    the 3 sources I used to come up with CreateNRs() :
    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx

  6. #6
    Registered User
    Join Date
    03-19-2013
    Location
    Penang
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Extracting conditional data from different sheet

    Hi Dredwolf,

    Appreciate your time spent on this.
    Sol2 works perfectly for me.
    I am using this sheets extensively in my dailly routines.
    Many thanks again.

  7. #7
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Extracting conditional data from different sheet

    Glad I could help

    Please remember to mark the thread as solved if you are satisfied with your solution :
    To mark thread "Solved", go to the top of the thread,click "Thread Tools",click "Mark as Solved"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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