+ Reply to Thread
Results 1 to 5 of 5

copying dates based on sum of units

  1. #1
    Registered User
    Join Date
    12-22-2014
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    89

    copying dates based on sum of units

    Hello experts,

    I am trying to solve below problem. Wondering if macro or a formula can help.

    Column A is the shipping date, Col B is the receiver ID, col C is the number of units shipped.

    Now if the number of units on a day is 4 or more then the date entered in result column must be same as in col A within the same row.

    If the number of units is less than 4 than check units in next row(date). if sum becomes 4 or more then enter the date corresponding to the row in the previous row.
    So until the sum of units becomes 4 or more keep checking next rows and then enter max date for those rows.
    Once the sum is 4 or more units go to the next row and check.

    max 4 rows will need to be looked because within 4 rows the sum should come to 4.

    Thanks
    Attached Files Attached Files
    Last edited by logisticsexcel; 02-11-2017 at 04:41 PM.

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

    Re: copying dates based on sum of units

    My suggestion:

    =IF(D2="morethan4", A2, INDEX($A3:$A$1000000, MATCH("morethan4", $D3:$D$1000000, 0)))
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    12-22-2014
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    89

    Re: copying dates based on sum of units

    Hi Jerry,

    Thanks for your repsonse. It seems to be working in most instances.
    It may need a bit tweaking.

    I noticed if there are 2 consecutive less than 4 then the formula is not summing them
    In row 114 & 115 the date should be 14/10/2016 and not 17/10/2016.
    Because the sum of units for row 114 & 115 is (3+3 =6) which is already more than 4


    summing.JPG

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: copying dates based on sum of units

    Try this ...

    =IF(C2>=4,A2,IF(B2=B3,IF(C2+C3>=4,A3,IF(B2=B4,IF(C2+C3+C4>=4,A4,IF(B2=B5,IF(C2+C3+C4+C5>=4,A5,""),""))))))

  5. #5
    Registered User
    Join Date
    12-22-2014
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    89

    Re: copying dates based on sum of units

    Hi Phuocam,

    Again when there are 2 consecutive less than 4 values the formula doesnt give result as expected.
    maybe there needs to be another check added in the formula
    Row 114 & 115 should have date as 14/10/2016 because the units in them sum up to 4 and more.
    And then the next row 116 needs to be treated as a new value and hence date as 17/10/2016.


    Thanks for your response

    summing.JPG

+ 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] Formula to determine number of units at each location and status of units
    By Klimer in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-18-2016, 10:01 AM
  2. Replies: 7
    Last Post: 04-30-2016, 03:20 AM
  3. Combining facts in different units in pivot-table
    By fredrikg in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-09-2014, 04:19 PM
  4. combining text from rows based upon current month dates
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-26-2014, 03:42 PM
  5. Convert units based on cell format
    By Redrum555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2012, 03:11 AM
  6. [SOLVED] Calculate the Bonus units according to the quantity of the units bought (Help)
    By mo_naf in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-15-2012, 05:51 PM
  7. How to determine the number of units based on given condition?
    By Eric in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2006, 05:25 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