+ Reply to Thread
Results 1 to 8 of 8

Returning multiple rows of data based on certain criteria

  1. #1
    Registered User
    Join Date
    12-19-2011
    Location
    Cluj, Romania
    MS-Off Ver
    Excel 2007
    Posts
    14

    Returning multiple rows of data based on certain criteria

    Hello, all,

    I've been browsing Excel forums for years now, but I've never felt the need to actually join one until now. I usually like to find solutions to my problems by myself, sometimes using various pieces of information I find here and there. But I have come to a full stop, due to lack of enough VBA knowledge at the moment - and I'd really need some guru's help.

    I've been challenged to create an Excel file that can provide an overview of the Materials Dept. Planning of the production vs. the Production Dept. actual realization dates. As you can see in the attached file - there are 2 sheets: the one labeled "Planned vs. Realized" is the one in which data is put in, as follows: the Mat. Dept. inputs the blue marked data, while the production should fill in the reddish one. The purple cells will be automatically calculated, based on the type of Finished Product on each specific order, and its respective production times.

    First thing I need help with would be some code (I presume) that does the following: every time a new order line is put in by the Mat. Dept - a new row gets inserted underneath, copying the order date, the order no. and the FP Type, as well as inserting the formula for calculating the Prod. Std. Finish Date

    Once all of this is done - we get to the really hard part, which is the Order Overview sheet. What I managed to do already (with google help...) is create a function that allows me to see all the orders planned to start at a certain date. Also, I have included that button to calculate the formulas, as for some reason it gives some errors without it. I don;t know if there's a better way to do that, but for now I am pleased with that.

    Now, coming to the real challenge: what I need to accomplish is this: as stated before, based on the FP Type, each order has a specific time frame in which it is finished. Let's say that for order "abcd" in the attached file - this frame is 13 days. In the overview - I would need to see order no. "abcd" listed under each and every date from the Prod. Real. Starting date (02.01.2012) to the Prod. Std. Finish Date (02.01.2012 + 13 = 15.01.2012). And that should happen with all orders, of course, so in the end I can see for a set period of time what's my planned production coverage.

    I would appreciate any help from you guys, and i hope I have been clear enough explaining what i want...

    Thanks a lot in advance,
    Radu

    Cross-posting: http://www.mrexcel.com/forum/showthread.php?t=600187
    http://www.ozgrid.com/forum/showthread.php?t=160897
    Attached Files Attached Files
    Last edited by ghurhu; 12-20-2011 at 10:16 AM.

  2. #2
    Registered User
    Join Date
    12-19-2011
    Location
    Cluj, Romania
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Code/Function for returning multiple rows of data based on a certain product type

    any ideas? Anybody? Something, please. At least the first part....

    Thanks...

  3. #3
    Valued Forum Contributor
    Join Date
    12-05-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    308

    Re: Returning multiple rows of data based on certain criteria

    Hi Ghurhu

    I have had a look at this. I can't understand what you need. Please could you provide some test data in the sample sheet? It is difficult to understand what your input and output are at present. I couldn't see 'abcd' in your attached file.

    Best regards, Rob.

  4. #4
    Registered User
    Join Date
    12-19-2011
    Location
    Cluj, Romania
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Returning multiple rows of data based on certain criteria

    Damn! For some reason - the attachment is not the one I prepared for this thread
    So - here is a new one.
    As said before - the colored (blue and red) fields in the Planned Sheet is entered manually by each respective Department.
    Row 3 in the example should be AUTOMATICALLY added when data is added in Row2. In the same way - if data is added in Row4 (for order no. "cdef") - Row 5 should be added automatically, etc.
    Also, the purple dates are based on the following info that will be added somewhere in the sheet: FP Type A=13 production days; FP Type B=90 days, etc.
    This is for the first part of what i need.

    For the second part (sheet 1, Overview) as you can see - at the moment all I was able to do is have the overview show what orders are planned to begin at the respective date. Further more, I need that overview to show NOT ONLY when an order begins being produced, but show it in the overview in each day of the production process, based on the number of days defined by FP Type. So, in the attached example - order "adcd" should be shown from Jan 1st to Jan 14th, order "cdef" from Feb 1st to May 1st, etc.

    N.B.: given that for sampling purposes, every second row in "Planned vs. realized" doesn't have active formulas - the formula in the "Overview" is set to refer to the date in the "Mat. Planned Starting Date". the real thing should refer to the date in "Prod. Real Starting Date"

    I hope this clears it up a little now....

    Looking forward to your reply,
    Radu
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    12-05-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    308

    Re: Returning multiple rows of data based on certain criteria

    Hi Radu

    1) Do you want buttons on the sheet to insert the new orders on the Planned vs realized sheet? You could do it using change events, but it might lead to problems in changing existing data, inserting additional rows where you don't want them, etc.
    2) Is it acceptable to have the orders on one line rather than spread over two? It would make the exercise a bit easier.

    The following code answers part 2 of the problem:
    Please Login or Register  to view this content.
    Note the change in variable type for MatchWith from string to single.

    Something else you might like to think about is Dynamic Named Ranges on the Planned vs realized sheet.

    Cheers, Rob.

  6. #6
    Registered User
    Join Date
    12-19-2011
    Location
    Cluj, Romania
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Returning multiple rows of data based on certain criteria

    Hi, Rob

    First of all - thank you! The code changes work like a charm!

    Now - coming back to my first part (which I thought was the easy one! duh!):
    1. Buttons are not necessary. they would probably be cooler - but then again - they might just make things harder to deal with.
    2. I also suggested one line (mostly because I also thought I'd be easier) - but that was a "special request" from "the man in charge" So technically - I DO still need two rows. But if that's TOO complicated - just let it be; I'll convince him (easily!) that it can't be done
    3. Dynamic Named Ranges mean nothing to me, at the moment; so I'd really appreciate it if you'd care to detail the matter a bit more.

    Thanks a lot one more time!
    (I'll keep the thread open until we clear the order issues, though)

    Radu

  7. #7
    Registered User
    Join Date
    12-19-2011
    Location
    Cluj, Romania
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Returning multiple rows of data based on certain criteria

    One more thing: is there a way to split the result in Order Overview in different columns? Like one column for each active order?

    Thanks

  8. #8
    Registered User
    Join Date
    12-19-2011
    Location
    Cluj, Romania
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Returning multiple rows of data based on certain criteria

    So I understand there are no new ideas here, right?
    cause if that's true - I might as well close the thread....

+ 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