Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a spreadsheet from which I need to select ONLY the first five rows in each category.

enter image description here

I only want columns A and B when C is less than 5 -- =IF($C1>5,$A1,) and =IF($C1>5,$B1,) -- but I would like to exclude blank rows when $Cn is greater than 4.

In a perfect world, there would be a function that I could append as the "fail" condition, giving me this: `=IF($C1>5,$A1,[insert next instance of $An where $C1<5])

Any ideas on making this simple?

share|improve this question
What version are you using? Have you tried using filters rather than formulas? – CharlieRB Mar 13 '13 at 19:59
Excel 2010, and no, I've not tried filters. A project for this morning. :) – dwwilson66 Mar 14 '13 at 11:17
up vote 3 down vote accepted

Insert a row below the category "I HAVE" and add column labels at the top of the column. Go to the Data tab and click Filter. This will add filter buttons to the column labels.

enter image description here

Click the drop down for the last column (I called it "Count"). Point to Number Filters and then Custom Filter. Select the first criteria to be Greater than and place a 0 in the next field. Leave And selected and then choose the criteria Less than in the next set. Place a 5 in the next field.

enter image description here

Click OK and it will filter out the rows which have a count of 0 and are less than 5. You will need to do the same thing for the other category of "I WANT".

share|improve this answer

Use Autofilter to show only rows with values less than 5.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .