?
Solved

how to get data validated lists in excel to score

Posted on 2011-10-05
15
Medium Priority
?
374 Views
Last Modified: 2012-05-12
I want to be able to use a drop down that I create in Excel using data validation (list) to assign a score to the cell next to the drop down in VBS.  How would I do that.  See file attached.
QCATScience.xls
0
Comment
Question by:Dier02
  • 8
  • 7
15 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 36922616
For example, put scores in H13:H23?  You can do that with VBA, but why not a formula?

How would you like to score?  Give an example of a drop down selection and relative score?  Do you have a table of scores based on drop-down values?  That would need to be provided in the spreadsheet, somewhere...

Dave
0
 

Author Comment

by:Dier02
ID: 36922833
I suppose you could do a drop down for the score but I was thinking it would be easier if you dropped down for the descrip[tor - which is already in the file - and VBA scored according to that descriptor.
0
 

Author Comment

by:Dier02
ID: 36922844
When you get to the end of the file- after filing in all the drop downs the idea is that the aggregated score is turned into an A,B,C,D or E.  Thats the end view.  At this point I just wanted to have only one drop down to get the score and the scoring would be 1 to 10.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 42

Expert Comment

by:dlmille
ID: 36922846
Ok.  Let's back up a bit.  The user selects a dropdown value from the list.  As a result of that dropdown, a score is tallied, somewhere.  And then, for the entire sheet, there's a score made up of all the scores in the sheet, correct?
0
 

Author Comment

by:Dier02
ID: 36922887
Yes, and then the final score is converted to an A,B,C,D or E.
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36922933
GREAT.  You need to provide more information, however.  Please pull up the worksheet you posted, and make sample entries, then beside the sample entries, notate how that entry would have been scored.  I cannot help you without understanding how you would score each and every response possible.  Feel free to create a table of responses and their respective scores on another tab with your example.  From that, it should move quickly.

Cheers,

Dave
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36923093
Maybe I'm not being clear enough.  Does every dropdown in the sheet result in a score, or is it just those at the bottom of the sheet?

Regardless, you need to identify which need a score and what the score would be for each possible response in the dropdown.  You can do that by creating a table of the possible responses (re: dropdowns) and score right beside it.  From that, a score could automatically be tallied, etc...

Dave
0
 

Author Comment

by:Dier02
ID: 36923155
Will do and sesend, thanks Dave.
0
 

Author Comment

by:Dier02
ID: 36923164
Just sent some code that is sort of along that road.  Will score sheet and resend.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range, TestRange As Range
Set myRange = Range("H13:H23")
Set TestRange = Intersect(Target, myRange)
If TestRange Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
    Select Case Target.Value
        Case "how hard I blow"
            Target.Offset(0, 1).Value = 5
            
            
        Case "Bob"
            Target.Offset(0, 1).Value = 2
            
            
        Case "Dave"
            Target.Offset(0, 1).Value = 3
           
            
            Case 4
            Target.Offset(0, 1).Value = 4
            
            
            
        Case 5
            Target.Offset(0, 1).Value = 5
            
            
        Case 6
            Target.Offset(0, 1).Value = 6
            
            
            Case 7
            Target.Offset(0, 1).Value = 7
            
            
            
        Case 8
            Target.Offset(0, 1).Value = 8
           
            
        Case 9
            Target.Offset(0, 1).Value = 9
            
            
            Case 10
            Target.Offset(0, 1).Value = 10
            
            
            
        
            
    End Select
End Sub

Open in new window

0
 

Author Comment

by:Dier02
ID: 36923218
Here is the scored file - the hyperlink to scores shows the scoring for each.
QCATScience.xls
0
 

Author Comment

by:Dier02
ID: 36930643
Dave?
0
 

Author Comment

by:Dier02
ID: 36930646
How is it going?
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36932665
Sorry, I've been out a couple days.  This was a good start, but incomplete as to table of responses and score.  I could perhaps provide a sample solution, moving downward a bit on the questionnaire, to demonstrate what I'm talking about.  But, to do the entire questionnaire is a big job, from what's been provided so far.

I'll start working on it and give you a partial to demonstrate how to do this, and submit something this weekend.  Will that work for you?

Dave
0
 
LVL 42

Accepted Solution

by:
dlmille earned 2000 total points
ID: 36933245
Ok - there's no need to do the VBA code you provided.

Here's a starting sample so you can see how its done.

I did two score areas (see yellow highlighting on attached workbook), to one side or the other of the drop-downs (these scores could all be moved to the right of the worksheet, even out of view.  Keeping them close as you have so we can make this happen.

All your data validation lists should be off tables like you created.  A VLOOKUP against the drop down result and the data tables (2 columns, match on left side, score on right) is created to capture the score.  Assuming you move all the scores to the right side of the sheet, it should be very easy to tabulate from that point.

As you may be able to see, there's no need to capture a worksheet_change event to make this happen - simple drop downs and vlookups are all that are needed.  You can put error checking in the vlookups to capture as well.. e.g,   =IF(ISERROR(VLOOKUP(whatever)),0,VLOOKUP(whatever))

Let me know if this helps.  Perhaps you can work this a bit and then flag me back when you need assistance?  PS - I also suggest eventually moving the scoring tables to another worksheet and create range names on top of each one - then you could use the range names for your data validation and vlookups.  Either way, your tables with scores (may I suggest) should be structured more, so they're organized well, blocked, etc., to make them easy to find and reference.

Please see attached.

Cheers,

Dave
QCATScience.xls
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36934672
just post back here if you have any issues.

Dave
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question