+ Reply to Thread
Results 1 to 5 of 5

Auto-increment across rows and columns

  1. #1
    Registered User
    Join Date
    09-19-2013
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    2

    Auto-increment across rows and columns

    I'm taking a shot in the dark here. I'm fairly certain what I'm trying to do is possible...it just might not be free

    I have some formula experience, less VBA experience. I have a file(s) where each row(element id) represents a device. Any given device may have 1, 2, 4, 6, or 8 cables, indicated by the GP_DropQuantity column. The 'CableID#' columns represent the cable #s for each device. These cable numbers need to increment sequentially so that there are no duplicates (and the sum of the drop quantity column equals the highest cableid value.

    It would be extremely helpful to be able to auto-increment the cableid values so that a change in one increments all subsequent cells.

    Or, to think of it another way, I've been wondering if there was a way to 'transpose' all the cableid values to one column, fill the series, and then return back to individual cableid columns. But I fear this would require introducing another column value to keep the devices in a specified order.

    Any ideas much appreciated. Thanks.

    Capture.PNG

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Auto-increment across rows and columns

    See next Post...
    Hi rwb, welcome to the forum! Paste this in C3 and copy down:
    =COUNT($D$2:$K2)+1

    ...and paste this in D3, copy across and down:
    =IF(COUNT($D3:D3)<$C3,D3+1,"")

    Row\Col
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    GP_DropQuantity CableID1 CableID2 CableID3 CableID4 CableID5 CableID6 CableID7 CableID8
    2
    GP_DropQuantity CableID1 CableID2 CableID3 CableID4 CableID5 CableID6 CableID7 CableID8
    3
    1
    1
    4
    6
    2
    3
    4
    5
    6
    7
    5
    4
    8
    9
    10
    11


    ...PS If you prefer to merge them into a single formula, paste this in D3:
    =IF(COUNT($C3:C3)<=$C3,COUNT($D$2:$K2)+COUNT($C3:C3),"")

    Please click the Add Reputation star below any helpful posts, and use Thread Tools (up top) to mark your thread as SOLVED once you have your answer. Thanks!-Lee
    Last edited by leelnich; 08-18-2017 at 09:57 PM.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Auto-increment across rows and columns

    Sorry just realized you wanted CODES, not NUMBERS. Paste this in D3, copy across and down:

    =TEXT(IF(COLUMNS($C3:C3)<=$C3,SUM($C$2:$C2)+COLUMNS($C3:C3),""),"0000")

    Row\Col
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    GP_DropQuantity CableID1 CableID2 CableID3 CableID4 CableID5 CableID6 CableID7 CableID8
    2
    GP_DropQuantity CableID1 CableID2 CableID3 CableID4 CableID5 CableID6 CableID7 CableID8
    3
    1
    0001
    4
    6
    0002 0003 0004 0005 0006 0007
    5
    4
    0008 0009 0010 0011
    6
    2
    0012 0013
    7
    6
    0014 0015 0016 0017 0018 0019
    8
    2
    0020 0021


    Please click the Add Reputation star below any helpful posts, and use Thread Tools (up top) to mark your thread as SOLVED once you have your answer. Thanks!-Lee
    Last edited by leelnich; 08-18-2017 at 07:26 PM.

  4. #4
    Registered User
    Join Date
    09-19-2013
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    2

    Re: Auto-increment across rows and columns

    Wow, amazing! Actually, the values should be numbers, not codes/text. That was an error on my part before I posted the screenshot. I was never able to get your last formula to work with the cells formatted as text.

    Thanks so much! You literally saved me hours, if not days, on this project alone. I should have asked for help earlier!

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Auto-increment across rows and columns

    Happy to help, thank you for the rep!
    PS For the codes formula, format the cells as General. The OUTPUT itself is text.

+ 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. Auto increment a week in the data after certain rows
    By rksingh2020 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-31-2016, 04:37 AM
  2. [SOLVED] How to Auto Increment the ROWS Function Horizontally
    By Statto in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-21-2014, 04:33 PM
  3. Increment columns in INDEX and MATCH formula - ROWS and COLUMNS
    By nickmangan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2012, 10:38 AM
  4. Auto increment Rows Number in a column using VB
    By chancw in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-04-2012, 01:28 PM
  5. How to increment / decrement rows / columns ?
    By naveenvarthaan in forum Excel General
    Replies: 1
    Last Post: 09-01-2009, 08:40 AM
  6. [SOLVED] Auto Increment Rows in between numbers
    By D in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2005, 01:06 PM
  7. [SOLVED] Excel Increment columns in rows
    By FGM in forum Excel General
    Replies: 4
    Last Post: 01-03-2005, 01:23 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