Closed Thread
Results 1 to 9 of 9

Formula to Return Results without any Empty Rows

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Formula to Return Results without any Empty Rows

    I have the following. I want to do a VLOOKUP (or similar) that will return only the results in Column B (Value) when the Criteria (Column A) is Yes, but I need the results in Column D to have no gaps as shown, so I think it needs an addition to the VLOOKUP to achieve this, but I don't know if it can be done with just a formula or would require some VBA? If the latter, I don't know how I would achieve this?

    Obviously if I do a straight VLOOKUP, the results in Column D will have blanks in it everytime there is a 'No' in Column A and I need the results to appear as per Column D below, without the blanks, is this possible to do?

    I've just noticed that the text below doesn't display so well, So, I've added a sample sheet.

    Many thanks

    A B D
    Criteria Value Result
    Yes 1000 1000
    Yes 2000 2000
    Yes 500 500
    No 100 20
    No 450 21
    No 750 500
    Yes 20 20
    Yes 21 35
    Yes 500 50
    No 7 1000
    No 7 250
    Yes 20 257
    No 15
    Yes 35
    No 47
    No 80
    No 41
    Yes 50
    No 9
    No 12
    Yes 1000
    Yes 250
    Yes 257
    Attached Files Attached Files
    Last edited by HangMan; 03-17-2015 at 08:47 AM. Reason: Addition of Sample Sheet

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula to Return Results without any Empty Rows

    hi HangMan. try this array formula:
    =IFERROR(INDEX($B$2:$B$100,SMALL(IF($A$2:$A$100="Yes",ROW($A$2:$A$100)),ROWS(C$2:C2))-ROW($A$2)+1),"")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    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: Formula to Return Results without any Empty Rows

    Array formula in D2 and copy down

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    )

    -- Array(CSE) { }, formulae are confirmed with Control+Shift+Enter.
    Not just Enter.
    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.

  4. #4
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Formula to Return Results without any Empty Rows

    Hi benishiryo and Fotis,

    I think you both had the same solution at the same time.

    That works perfectly, many thanks to both of you for coming back so quickly and taking the time to reply...

  5. #5
    Registered User
    Join Date
    12-02-2008
    Location
    Manila, The Philippines
    Posts
    22

    Re: Formula to Return Results without any Empty Rows

    Hello Benishiryo,

    I adapted the array formula you gave as a solution to this thread to solve a similar problem I was trying to solve. I think this link might take you to that thread:

    http://www.excelforum.com/excel-gene...t=#post4311498

    I want to give you credit for your immense contribution to me finding my solution so, if you can leave a message on my thread I'll be able to do so. In fact, you might like to quickly look at my post announcing a solution and its attached excel workbook and comment, maybe even suggest a shorter/better way.

    Meanwhile, thank you.

    Regards,
    Jon.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: Formula to Return Results without any Empty Rows

    Would you consider a helper column? In C2 this filled down to row 24.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then this non-array formula in D2 filled down until you get blanks.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  7. #7
    Registered User
    Join Date
    12-02-2008
    Location
    Manila, The Philippines
    Posts
    22

    Re: Formula to Return Results without any Empty Rows

    Hi Dave,

    I tried what you suggested (making allowance for the fact I have no data in column A of either worksheet - and guessing you meant to put both these formulas on the summary worksheet - the first starting at C12 and the second one replacing the array formula starting at D12). I didn't recognize the end reference ($2:2) but left it as you put it. =IFERROR(INDEX($B$2:$B$24,SMALL($C$2:$C$24,ROWS($2:2))),"") The result was I lost the number of items in that room (in fact, it was replaced with 'Yes'.

    Yes, it would be good if I could change an array formula with a shorter non-array one as any changes needed would be easier but, it still has to give me a closed up list of items and the corresponding number of those items.

    Regards,
    Jon.

  8. #8
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Formula to Return Results without any Empty Rows

    or Try

    E2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  9. #9
    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: Formula to Return Results without any Empty Rows

    Unfortunately your post(S) does(DO) not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Search Workbook for cells that meet multiple criteria and return results from rows
    By CFritz7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2013, 04:41 PM
  2. Replies: 10
    Last Post: 10-15-2012, 11:46 PM
  3. Repeat Function return results from absolute rows
    By SpAnKy in forum Excel General
    Replies: 1
    Last Post: 05-09-2011, 08:29 AM
  4. Return results based on rows and columns.
    By Darreno in forum Excel General
    Replies: 3
    Last Post: 10-12-2010, 03:55 PM
  5. [SOLVED] put formula results into a different cell if it is empty
    By PutFormula in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-11-2005, 12:06 AM

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