+ Reply to Thread
Results 1 to 7 of 7

IF Statement for multiple lines

  1. #1
    Registered User
    Join Date
    10-15-2017
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    3

    IF Statement for multiple lines

    Hi guys, first time poster. Have been trying to solve something for a while, and have not found a solution. I am fairly novice with using Excel. Any help would be greatly appreciated!

    Essentially, I am trying to create a warehouse assignment sheet, where the assigned warehouse is based off of certain logic:

    IF all the line items for the order numbers are at available at the "EB" warehouse, then assign all line items to "EB" in the warehouse column.
    IF all the line items are not available at "EB" but are available at "VGM", then assign all line items to "VGM" in the warehouse column.
    IF all the line items are not available at "EB" or "VGM", then assign all line items to "PPM" in the warehouse column.

    I was able to create a bootleg version of this logic for order numbers with ONE line item, but was not able to figure out the logic to apply this to order numbers with MULTIPLE line items. Is there any way to make this logic work for multiple line item order numbers?

    Thank you for any assistance. I have included an attachment as well.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,483

    Re: IF Statement for multiple lines

    I think this is it, you may have to edit it.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-15-2017
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    3

    Re: IF Statement for multiple lines

    Hi davesexcel. Thanks for the quick response and willingness to help! One thing that I failed to mention in my original post of the problem: If an order contains multiple line items, we are trying to assign the multiple line items to the same warehouse, as to not split shipments. For example cells A10 to A12 should all return "VGM", as to not split the order between "EB" and "VGM" (see attachment).

    Can you think of any formula to incorporate that logic?
    Attached Images Attached Images

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,594

    Re: IF Statement for multiple lines

    Try the following:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Was not sure how you would want to handle a case where none of the warehouses could handle the entire order, such as order # 1507139674-471 (rows 19:21), so had to guess on that one.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,594

    Re: IF Statement for multiple lines

    This may produce more aesthetically pleasing output:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  6. #6
    Registered User
    Join Date
    10-15-2017
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    3

    Re: IF Statement for multiple lines

    Wow, JeteMc, I cannot thank you enough. This logic will save my company 15 hours a week or more! A quick follow-up question: Do you know if it is possible to display the assigned warehouse to all of the line items for an order number, rather than just the first line of the order? Please see example image attached.
    Attached Images Attached Images

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,594

    Re: IF Statement for multiple lines

    You're Welcome and thank you for the feedback. The formula in post #4 shows the assigned warehouse on all lines, the formula in post #5 is just an option. If the solution is satisfactory, please take a moment to mark the thread as 'Solved' using the thread tools link above your first post. I hope that you have a blessed day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Select Case with multiple lines in a case statement?
    By jGKpZ8a33sPrnqX8fam7 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-02-2017, 10:25 AM
  2. Replies: 1
    Last Post: 05-06-2016, 08:22 PM
  3. Need VBA help: if statement, reading lines, copying lines in new sheet.
    By angwoodr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-17-2015, 06:08 PM
  4. Statement break into two lines
    By kop1ko in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2015, 04:01 PM
  5. IF Statement comparing multiple lines
    By glas2744 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2013, 01:16 PM
  6. [SOLVED] Sub is skipping lines of code after Then statement
    By chavez982 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-05-2012, 10:32 PM
  7. Adding lines, for loop, if statement question
    By bishopmp1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-24-2008, 10:50 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