+ Reply to Thread
Results 1 to 7 of 7

Drop Down Lists - Values assigned to Text

  1. #1
    Registered User
    Join Date
    05-10-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    18

    Drop Down Lists - Values assigned to Text

    Hi everyone,

    I’m a bit stuck on where to put this query as its within the excel worksheet, however if possible, I’d quite like it to work using VBA (if possible) within the worksheet. Although i’m not sure if it can be done.

    I want to create 4 separate lists on the same worksheet. Within the lists, I’d like each option (which will be text of some kind) to have a figure assigned to it.

    For example:

    Blue = 1
    Apple = 2

    What I’d like is when selecting “Blue” from the drop down box, it displays as “Blue” in the sheet but is actually seen by the cell as having a value of 1. Then I’d like each value to be calculated (added together) to create a sum value.

    Let me give you an example.

    Lets say I have 4 Lists (In Cells A1, B1, C1, D1):

    List 1
    Blue = 1
    Red = 2
    Green = 3

    List2
    Orange = 1
    Apple = 2
    Mango = 3

    List3
    Carrot = 1
    Onion = 2
    Garlic = 3

    List 4
    Car = 1
    Van = 2
    Bike = 3


    Lets say in each list I have the following options selected.

    Blue / Apple / Carrot / Bike

    In Cell E1 I’d like the value = 7 to be displayed.

    Quite important is that not all the cells have to have an entry for the sum to work. So lets say I have no value in list2 selected. I’d like:

    Blue / Carrot / Bike

    In Cell E1 I’d like the value = 5 to be displayed.

    I’m not sure if this can be done within the sheet itself, or if its easier doing so via VBA and then linking to lists within the sheet. I think VBA would be a much simpler way and cleaner way of doing it (if its possible.)

    I hope I make sense with what I’m saying though. I really hope someone can help.

    Thank You,

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Drop Down Lists - Values assigned to Text

    Hi

    Why do you need a macro for this?

    You can use easy formula and do it.

    Starting in K3 and down, type your text. Starting in L3 and down type your numbers.

    Then this formula,in E1, will gives you your results.

    =SUMPRODUCT((K3:K14=A1:D1)*(L3:L14))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    05-10-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Drop Down Lists - Values assigned to Text

    Hi Fotis,

    Thank you for the suggestion.

    That works fine for one individual list. However I have 4 seperate lists. Can this be edited to use 4 seperate lists?

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Drop Down Lists - Values assigned to Text

    What do you mean?

    This works for lists in A1-B1-C1-D1, as your request in your first post.

  5. #5
    Registered User
    Join Date
    05-10-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Drop Down Lists - Values assigned to Text

    Hi Fotis,

    I'm really sorry, I was getting a little bit confused (long day at work.) As you say, your original suggestion works perfectly. It's exactly what i'm looking for.

    Really really appreciate your help! Thank you very much.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Drop Down Lists - Values assigned to Text

    You are welcome

    Pls, mark your THread as Solved.

  7. #7
    Registered User
    Join Date
    05-10-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Drop Down Lists - Values assigned to Text

    Hello,

    Sorry to bring this up. But my issue doesn't seem to be resolved. The workings are there however the addition doesn't seem to be working correctly.

    With the following code. If I was to select an option in List 1 that has a value of 1.8, and an option in List 2 that have a value of 1.8. The result is 5.4 , rather than 3.6 as it should be.

    Please Login or Register  to view this content.
    Can anyone see why that would be the case?

+ 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