Solved

Excel: Return Multiple Rows with No Row Gaps (combo box)

Posted on 2014-04-15
3
215 Views
Last Modified: 2014-04-15
Hello,

Not sure if this is possible.

I have the following dataset on two separate rows. The first column is a combination box.

[yes/no]      Sentence 1
[yes/no]      Sentence 2
[yes/no]      Sentence 3
[yes/no]      Sentence 4

I have a further 4 rows where I would like to display only the sentences with [yes] next to them. I would like there to be no row gaps between the sentences. E.g:

Sentence 1
Sentence 3

(above example is if [yes] = sentence 1 & 3 - note there is no 'blank row' between the sentences, they appear one row after the other)

Hopefully I explained this ok.

What's the best way of getting this to work?

Thanks.
0
Comment
Question by:dabug80
  • 2
3 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 40003100
Use the following array-entered formula, entered in cell F10 in this example:
=IFERROR(INDEX(B$1:B$4,SMALL(IF(A$1:A$4="Yes",ROW(A$1:A$4)-ROW(A$1)+1,""),ROWS(F$10:F10))),"")

If you put the formula in a different cell, then change the reference to F$10:F10 accordingly. As you copy the formula down ROWS(F$10:F10) will return the series 1, 2, 3, etc.

To array-enter a formula:
1.  Click in the formula bar
2.  Hold the Control and Shift keys down
3.  Hit Enter, then release all three keys
Excel should respond by adding curly braces { } surrounding your formula. If you don't see them (or if the formula returns an empty string (looks like a blank), then repeat steps 1 to 3.

You may copy the array-entered formula down. When the list of Yes answers is exhausted, the formula returns an empty string.


If you want to use the results in a data validation dropdown, use a dynamic named range like:
=$F$10:INDEX($F$10:$F$100,COUNTIF($F$10:$F$100,"?*"))
This formula will count the sentences, but ignore the empty strings.
0
 
LVL 1

Author Comment

by:dabug80
ID: 40003157
Wow! That is an excellent solution. You solved it. And to think I thought it couldn't be done.

Thanks so much for your solution
0
 
LVL 1

Author Closing Comment

by:dabug80
ID: 40003158
Thanks
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

Suggested Solutions

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

863 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

21 Experts available now in Live!

Get 1:1 Help Now