+ Reply to Thread
Results 1 to 3 of 3

Add numbers to column based on order number change

Hybrid View

fpmsi Add numbers to column based... 11-11-2013, 11:22 AM
ragulduy Re: Add numbers to column... 11-11-2013, 11:41 AM
Carl Willems Re: Add numbers to column... 11-11-2013, 11:48 AM
  1. #1
    Registered User
    Join Date
    06-19-2009
    Location
    United States, MA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Add numbers to column based on order number change

    I have an excel spreadsheet that looks like the following.

    Order No. Order Date Ordered By Ordered By Company Ordered For Ordered For Company Product Code, Revision Version
    100739 11/1/2013 Scott, Kimberly Virtus James Delbert Browning, - Edward Jones 8020, 0113 B258
    100739 11/1/2013 Scott, Kimberly Virtus James Delbert Browning, - Edward Jones 8417, 0613 B4

    100740 11/1/2013 Butler, Jessica Virtus Troy Lawrence Young, - First Citizens Securities Corp 8020, 0113 B258
    100740 11/1/2013 Butler, Jessica Virtus Troy Lawrence Young, - First Citizens Securities Corp 8415, 0613 B4

    100746 11/1/2013 Salerno, RJ Virtus John O'Neil, - Merrill Lynch VIR003, 1
    100746 11/1/2013 Salerno, RJ Virtus John O'Neil, - Merrill Lynch VIR008, 0112
    100746 11/1/2013 Salerno, RJ Virtus John O'Neil, - Merrill Lynch VIR021, 1

    I am creating a macro that will insert two new columns at the beginning of the spreadsheet named,(Order and Lines).
    I need to find a way to automatically fill in a "1" in the first cell of the order? and then "1" on each other line items in the "Lines" field.

    Result would be:
    Order Lines Order No. Order Date Ordered By Ordered By Company Ordered For Ordered For Company Product Code, Revision Version
    1 100739 11/1/2013 Scott, Kimberly Virtus James Delbert Browning, - Edward Jones 8020, 0113 B258
    1 100739 11/1/2013 Scott, Kimberly Virtus James Delbert Browning, - Edward Jones 8417, 0613 B4

    1 100740 11/1/2013 Butler, Jessica Virtus Troy Lawrence Young, - First Citizens Securities Corp 8020, 0113 B258
    1 100740 11/1/2013 Butler, Jessica Virtus Troy Lawrence Young, - First Citizens Securities Corp 8415, 0613 B4

    1 100746 11/1/2013 Salerno, RJ Virtus John O'Neil, - Merrill Lynch VIR003, 1
    1 100746 11/1/2013 Salerno, RJ Virtus John O'Neil, - Merrill Lynch VIR008, 0112
    1 100746 11/1/2013 Salerno, RJ Virtus John O'Neil, - Merrill Lynch VIR021, 1

    Basically a client pays a price per order, and a price per additional item in the order, so I will sum these up at the bottom of the spreadsheet.

    Any help in the right direction would be appreciated. The new orders always have a blank row above it so the formula can basically say if cell in column "C" is blank do this until "C" is blank again.

    Thanks
    Ryan.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Add numbers to column based on order number change

    in A2: =IF(and(Countif($C$1:C1,"="&C2)=0,not(C2="")),1,"")
    in B2: = IF(and(Countif($C$1:C1,"="&C2)>0,not(C2="")),1,"")
    and copy down

  3. #3
    Registered User
    Join Date
    06-24-2013
    Location
    Turnhout, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Add numbers to column based on order number change

    Hi Ryan,
    Assuming that de column Order is col. A and the order number is in col. C. Put in col A the formula =IF(C1="";1;"") where C1 is on the row above the formula, thus in this example the formula sits in A2. This will put a 1 in front of each new order.
    Put in col. B the formula =IF(C2<>"";1;"") on the same line as the order number (thus in this example in cell B2). Then pull those down as far as needed.

    best regards,
    Carl

+ 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] Quantity in column D based on order amount of times the order no appears
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2013, 06:48 PM
  2. [SOLVED] VBA to detect change in order number, then add a value to each 1st line of that order
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2013, 09:19 AM
  3. [SOLVED] Count the number of unigue numbers based on number in another column.
    By ksmith4809 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-27-2013, 09:11 AM
  4. [SOLVED] Need a column of numbers based on text & number entries
    By prssmzk in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-24-2013, 11:10 PM
  5. Adding up numbers based on number in separate column
    By jhelliar in forum Excel General
    Replies: 2
    Last Post: 09-08-2009, 04:53 PM

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