+ Reply to Thread
Results 1 to 9 of 9

Drop-down List for Customer Database

  1. #1
    Registered User
    Join Date
    02-07-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Drop-down List for Customer Database

    Hi,

    I need to create a macro (or figure out some other way) to do the following:

    If you look at the attached spread sheet you will see the first tab "Raw". This sheet contains customer information that is automated when someone signs up on a website. The problem is that when a customer selects more then one "Communication Attribute Description" the system makes a different row for each "Communication Attribute Description" selected.

    Is it possible to create a macro that would remove duplicates and give me a drop down list in the "Communication Attribute Description" column that would show all attributes that were selected. For an example see the tab "Simple".

    I have tried using VLOOKUP and IF functions to do this but I cant get to a solution that is easily readable and is time efficient.

    Thanks for your help!
    Attached Files Attached Files

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

    Re: Drop-down List for Customer Database

    Hi jbkline and welcome to the forum,

    The topic you need is Cascading Validation lists. Read:
    http://www.tushar-mehta.com/excel/ne...#Introduction_

    See if it helps. If not then let us know and we can see where we need to start.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-07-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Drop-down List for Customer Database

    Thank you MarvinP for responding so quickly! I read through that tutorial and I don't understand how Cascading Queries work or how I would implement it into my database. In the raw data sheet each name is not repeated the same number of times since it is dependent on how many Attributes are selected, Min attributes=0 Max attributes=32.

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

    Re: Drop-down List for Customer Database

    Hi jbkline,

    If cascading validation lists aren't enough to solve your problem then you need to jump harder into VBA. Another possible option is a MultiSelect ListBox that allows you to select multiple things in a single list.
    Read about them at:
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx or search the net for Multiselect Listbox.
    Does this fit your problem better? Are you VBA savvy enough to deal with code? I was hoping that non-vba validation lists would do it for you.

    Let us know.

  5. #5
    Registered User
    Join Date
    02-07-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Drop-down List for Customer Database

    Thanks again for replying MarvinP,

    The cascading validation lists may be enough to solve my problem but I didnt know how to implement the cascading validation I keep getting #VALUE errors when I try. I also unfortunately don't know a whole lot about VBA, id rank my VBA skills 2 out of 10.

    jbkline

  6. #6
    Registered User
    Join Date
    02-07-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Drop-down List for Customer Database

    MarvinP,

    One thought I had was using the OFFSET(reference, rows, cols, [height], [width]) function because it should return me a range of results correct? The problem I'm running into with the OFFSET function is the "reference" part of the formula. I tried putting a VLOOKUP in for the reference but VLOOKUP returns the value thats in the cell not the cell reference that the value is first found in. I think if i could get the VLOOKUP to return the cell reference instead of the value I could use a MATCH function for the "[height]" input and get it to return all the different "Communication Attribute Descriptions" under each name. Is this logic sound or am I just way off?

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

    Re: Drop-down List for Customer Database

    OK jbkline,

    Here is what I think you are looking for - in the attached.
    I wrote some VBA behind your sheets. When you now click on column B it will put the name to the right of it in the Criteria area of Sheet1 and perform an Advanced Filter. It then sorts these unique values. The validation list now comes from sheet1 on the filtered and sorted range.

    Look at the attached. Try it a few times. Find all the named ranges and note where they are.

    Look at the code - there are two places. One is behind the sheet and the other is in a module.

    Change some of your Raw data and see if it still works. (remember to expand the named range on the Raw sheet).

    Let me know how it works - now you should be motivated to read and learn a little VBA.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-07-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Drop-down List for Customer Database

    MarvinP

    That macro works great and does exactly what I wanted! Thank you for your help. I do have one question though. I can only get the drop-down lists to appear for the 1st 14 cells in the "Simple" sheet, how do I put in the drop-down lists for all of the remaining cells?

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

    Re: Drop-down List for Customer Database

    Hi,

    You need to look at and understand Data Validation Lists a little better.
    Click on B2 on the Simple sheet and then on the Data Tab. Then look for the Data Tools Group and click on the Data Validation dropdown. Click the word "Data Validation..." from the choice of 3 icons.

    Now a window opens and on the Settings Tab it says Allow: List with a Source: =ValSelection. You are looking for the Validation setting for only one Cell, B2.

    To make this work for a lot more cells you must first select them. Click and drag you mouse from B4 down to B100. WITH THIS RANGE SELECTED, now click on Data Validation and make it a List = ValSelection. This will then make all the selected cells be Validation Cells.

    You do see that I have named ranges in the formulas. You may need to go into Formulas -> Names Manager and edit those Named Ranges to be longer to span your entire dataset.

    Also the VBA behind the Simple sheet has a fixed range in the code from B2:B100 which may need to be expanded if you have more than that many rows.

    There was a lot involved in your request. Formulas, Named Ranges, Validataion Lists, Advanced Filters, Unique Advanced Filters, Sorting, Event Macors, Intersect with Target, and Module VBA Code. There are a lot of places that need to work together to get a full scope of what's-a-happenin.

    I hope this helps.
    Last edited by MarvinP; 02-09-2011 at 05:53 PM.

+ 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