Solved

Ignore blanks in Dropdown list from form control

Posted on 2014-11-13
17
364 Views
Last Modified: 2014-11-14
I'm using a dropdown list from the form control and populating it with a named range which gets its data from

=MarkEntry!$A$7:$A$108

The range accommodates about a 100 students, sometimes there are less, but the last row is always needed in the dropdown, because it has the class average. How would I ignore the blank lines when populating the dropdown.
0
Comment
Question by:zerog
  • 10
  • 7
17 Comments
 
LVL 29

Expert Comment

by:gowflow
ID: 40439704
Several ways

1) A small VBA can do this eliminating blanks to fill the dropdown
2) A VBA to sort the data and only capture data except blanks

Your choice
gowflow
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40439711
You also may want to look at this link

http://www.cpearson.com/Excel/noblanks.htm

gowflow
0
 

Author Comment

by:zerog
ID: 40439714
My knowledge with VBA scripting is limited ... any samples or leads that can assist?
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40439749
Sure no sweat just post your sample workbook so this way the solution will be adapted exactly to your need.
gowflow
0
 

Author Comment

by:zerog
ID: 40439761
Thank you. See the second dropdown list on the "IndividualGraph" sheet.
Graphs.xlsx
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40439964
ok here it is I created in sheet in Col BA7 and down the following formula as Array (CTRL,SHIFT,ENTER) and I called this new Range NoBlankCell
=IFERROR(INDEX($A$7:$A$108,SMALL((IF(LEN($A$7:$A$108),ROW(INDIRECT("1:"&ROWS($A$7:$A$108))))),ROW(A1)),1),"")

Open in new window


Then I modified your Range Name to be as follows:
=OFFSET(NoBlankCell,,,COUNTA(NoBlankCell)-COUNTBLANK(NoBlankCell))

Open in new window


Now check if this is what you want. I deliberately created stupid names as you can see in different rows to make sure it is working properly.

NOTE
I have to thank you for your question as I am not a 'Formula' Guy but rather a VBA one but seems the challenge and your extensive use of Named Ranges got me to fix it this way.

Regards
gowflow
Graphs.xlsx
0
 

Author Comment

by:zerog
ID: 40440118
Thanks gowflow for your solution. The dropdown works as I wanted. I just notice that the class average no longer plots on the graph. I get a #VALUE!
Must be something to do with the referencing. I'm just wondering would a VBA solution avoid that from happening?
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40440430
Wait Wait.

What is the Class average ? In what sheet ??? If in IndividualGraph the file you posted did not have the Average !!! In Summary the Average is there.

Pllsadvise
gowflow
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:zerog
ID: 40441899
Below the graph on the "IndividualGraph" sheet there's a table that displays the data for the selection from the dropdown lists. If you choose class average from the second dropdown the table no longer populates.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40441956
I see what you mean let me look at it and will revert.
gowflow
0
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 40442063
ok here it is:

I had to create a new name range and put this formulas.
DB_Selected_Blank
=MATCH(IndividualGraph!$B$26,MarkEntry!$A$7:$A$108,0)

Then I modified the formula in C26 onward to take into consideration the correct row of this item as the problem rised from the fact that Class Average and other items were taking a sequential row count (7 for this one) instead of 102 and as in row 7 the data was null you were getting a division by 0 reason why the formula was wrong.

So this new formula fixed it.
=VALUE(INDEX(DB_Table1,DB_Selected_NoBlank,C$22))

PLs check it and let me know.
gowflow
Graphs-V01.xlsx
0
 

Author Comment

by:zerog
ID: 40442074
Perfect. Thank you for all your help
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40442078
Your welcome, a small comment I did not understand why the first combo does not populate all the names !
gowflow
0
 

Author Comment

by:zerog
ID: 40442124
The first dropdown excludes the Class Average from the name list and the second dropdown includes the Class Average from the name list. It was just a quick workaround to avoid Class Average being compared to Class Average on the graph
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40442376
Ah Ic.
If you need more help pls do not hesitate to put a link to any question you may have in here.

Regards
gowflow
0
 

Author Comment

by:zerog
ID: 40442412
Thank you. Much appreciated
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40442653
Your welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

896 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now