+ Reply to Thread
Results 1 to 10 of 10

Return multiple rows from a single formula?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-05-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Return multiple rows from a single formula?

    I have attached a dummy file DummyWorkbook.xlsx with a worksheet for data and a worksheet for desired results. I want to be able to enter a date and description on one sheet and then on my second sheet, enter a date range and have the rows below populate with any dates and their corresponding descriptions from the 1st sheet. I do not want there to be any empty rows and would ideally enter a formula in a single cell (not using vba) to achieve this.
    Last edited by morgens; 02-13-2012 at 09:47 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    02-05-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Return multiple rows from a single formula?

    Anyone? Even if it can't be done without VBA, I would appreciate ANY info you can give me. Thank you!

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Return multiple rows from a single formula?

    B1: =MIN(Data!A:A)
    D1: =MAX(Data!A:A)

    B5: =IF($B$1-1+ROW(A1)>$D$1,"",VLOOKUP($B$1-1+ROW(A1),Data!$A:$B,2,0))
    ...copy B5 down as far as you'd like.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    02-05-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Return multiple rows from a single formula?

    thanks for the response. I appreciate you taking the time. It's great that the list begins with the start date, regardless of what start date is on the data sheet. Unfortunately this doesn't quite solve my problem. I still have two issues here:

    1. If there are multiple descriptions for the same date, it will only return the first occurrence.

    2. Also, it is leaving a slot for each date, so I added a description for 1/12 and it listed it in the 12th spot, but left all cells between that description and the previous date as #N/A. Ideally, there would be no blank or n/a cells.

    any idea on how to solve one or both?

    thanks again.

  5. #5
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Return multiple rows from a single formula?

    Hi

    In data sheet in Column A i have enetered the formula to increase by one if the date fallss between the range date given in desired results sheet.

    =IF(AND(B2>='Desired Results'!$B$1,B2<='Desired Results'!$D$1),A1+1,A1)
    Then in "Desired Result"s sheet i use vlookup to extrect the rows useing row function.

    =IF(ISERROR(VLOOKUP(ROW(A1),Data!$A$2:$C$7,3,FALSE)),"",VLOOKUP(ROW(A1),Data!$A$2:$C$7,3,FALSE))
    See the attached


    Regards
    Attached Files Attached Files
    Last edited by mahju; 02-12-2012 at 12:32 PM.
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Return multiple rows from a single formula?

    You're saying your sample sheet originally doesn't actually show your entire scenario? Redo that and be sure to fully demonstrate what you're doing, not just parts of it. Thanks.

  7. #7
    Registered User
    Join Date
    02-05-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Return multiple rows from a single formula?

    mahju,
    thank you for your response. I am afraid those formulas do not achieve the desired results. The 1st Description of the desired results does return correctly, but not necessarily the rest or the complete desired date range. Thank you very much for the effort.

    JBeaucaire,
    I apologize for not including enough data to start. I have added a few rows to the data set as well as a second possibility for desired results. Hopefully this will give a more complete picture of what I am looking for.

    You can see that there will be multiple descriptions for a given date.

    The Start and End dates will be manually entered so that I can choose a date range to summarize.

    I will need to print out this summary on a weekly basis. The data set will likely have over 1,000 entries by years end, but I would still like to be able to pull descriptions within a given date range and print it out without spaces between the descriptions.

    I guess I am basically looking to replace the manual action of sorting by date on the data sheet, copying the descriptions within the desired range and pasting on a summary sheet. There are other calculations for the given date range that are included on that summary as well that I have already figured out.

    thanks again for your help and please let me know if you need any additional information.
    Attachment 141086DummyWorkbook_updated.xlsx

  8. #8
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Return multiple rows from a single formula?

    Quote Originally Posted by morgens View Post
    mahju,
    thank you for your response. I am afraid those formulas do not achieve the desired results. The 1st Description of the desired results does return correctly, but not necessarily the rest or the complete desired date range. Thank you very much for the effort.
    Hi

    I checked if you set the formulae as in sheet it will give all description
    any way thanks fo your coments
    Regards

  9. #9
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Return multiple rows from a single formula?

    Try this

    In B5, with CTRL+SHIFT+ENTER, rather than just ENTER

    =LOOKUP(REPT("z",255),CHOOSE({1,2},"",INDEX(Data!B:B,SMALL(IF(Data!A$2:A$40>=B$1,IF(Data!A$2:A$40<=D$1,ROW(Data!A$2:A$40))),ROWS(B$5:B5)))))

    Then copy down.

    Assume you are on XL 2003
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  10. #10
    Registered User
    Join Date
    02-05-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Return multiple rows from a single formula?

    Haseeb A,
    This appears to work! thank you. Now I just need to take some time to understand why. Thank you so very much for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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