+ Reply to Thread
Results 1 to 4 of 4

Auto Numbering Across Sub-Sections

Hybrid View

  1. #1
    Registered User
    Join Date
    02-17-2020
    Location
    Detroit, MI
    MS-Off Ver
    2019
    Posts
    9

    Auto Numbering Across Sub-Sections

    Please forgive me if my terminology is incorrect. I've attached the sheet I'm working on but my question is this. Let's say I have 4 subsets of data, and the 4 headings I have are Apples, Oranges, Grapes, and Pears. Under each heading, Apples for example, I have listed different types of Apples (Golden, McIntosh, Granny Smith, etc). The same is true for each fruit. I want to have a column called Item, which will be numerical. In apples, there will be items 1-7, In Oranges 8-12, Grapes 13-20 and so on. When I insert a row into Apples, it will automatically change the item number in the 4 different groups so there are no duplicate item numbers. Now, if everything was in a row, I know that I could use auto-count and when I added a row it would automatically adjust, but I have gaps in between my data groups and I don't know how to make it automatically adjust like that.

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Auto Numbering Across Sub-Sections

    Here, maybe, is a possibility, but first it is going to work much more efficiently if you can at least remove col-A from the merge of the ("apples" and "oranges") rows: 27:29, 39:41 etc.

    As a side note and another alternative, you can achieve what you are doing here without merging cells via: removing the merge, then select B27:J29, right-click > format cells > alignment > Horizontal > "Center across selection". In general merged cells create more pain than help.

    Here is the numbering suggestion (it assumes you have removed any merges involving col-A):

    Enter 1 in A15
    Enter in A16 and copy down to A63:
    Formula: copy to clipboard
    =IF(B16="Qty", "Item",  IF(ISNUMBER(B16), COUNT($A$15:$A15)+1, ""))


    Note that col-A numbering will appear blank unless there there is an entry in col-B (Qty).

    The numbering remains consistent if you delete rows.If you add rows then it's best if you select A16 and copy down to A63 again.

    I noticed in testing that you have different colors in alternate rows and that this pattern is lost as rows are deleted or inserted. If you have been adjusting this shading manually, be aware that the alternate row coloring can be maintained entirely automatically via conditional formatting. If you want details, let us know.

    The attached workbook demonstrates the numbering down as far as row-40 (no further as I didn't do the necessary unmerging below that).

    Hope this helps. Let us know.
    Attached Files Attached Files
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  3. #3
    Registered User
    Join Date
    02-17-2020
    Location
    Detroit, MI
    MS-Off Ver
    2019
    Posts
    9

    Re: Auto Numbering Across Sub-Sections

    I have no doubt that I am doing something wrong. The way you sent it back , the format, will work perfect but for some unknown reason when I insert a new row it doesn't automatically update the item number. I have to copy (drag) the formula back down again. Unless I mistook your post and that is what I have to do in order to update it? I probably didn't clarify. Sometimes the Apple group may have 5 apples in it, while other times it may have 20 apples in it. When it has 5 apples in the group I don't want 15 empty rows. I want to add and remove rows as necessary so that every row in each group will have data in it. Sorry about not defining that better.

    Thank You
    Last edited by Nonoffensive Name; 07-23-2020 at 06:26 AM.

  4. #4
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Auto Numbering Across Sub-Sections

    but for some unknown reason when I insert a new row it doesn't automatically update the item number. I have to copy (drag) the formula back down again.
    Here's what I said in post #2:
    The numbering remains consistent if you delete rows.If you add rows then it's best if you select A16 and copy down to A65 again.
    With the workbook as you provided it there was no way in a single step to "select A16 and copy down to A65 again. This is because the merged cells that you have between sections do not allow A16 to A65 to be selected in one go.

    In the workbook that I attached to post #2 I had removed some but not all of the problem merged cells. Attached to this post is a version of your workbook with all such merged cells removed.

    What I recommend is that you add/delete rows as necessary, then, as a last step, when you are done:
    1. select A16
    2. copy
    3. select A17 to A65 (or whatever your last row is)
    4. paste-formulas (has to be paste-formulas or border formatting between sections will be lost)

    Give it a try, but if this still proves to be more than you want to do then I think a VBA approach may be necessary.
    Attached Files Attached Files

+ 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. Multi level reference id - auto numbering - similar to legal numbering
    By smsko in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-11-2017, 06:05 AM
  2. weird (auto numbering) numbering ....
    By freestone in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-20-2010, 07:46 PM
  3. help:Auto Numbering
    By dropdesigns in forum Excel General
    Replies: 4
    Last Post: 11-13-2009, 06:43 PM
  4. Possible to do auto-numbering after auto filtering?
    By hello_lpc in forum Excel General
    Replies: 1
    Last Post: 11-10-2009, 03:18 AM
  5. WBS numbering help, auto numbering with indenture
    By hisham2929 in forum Excel General
    Replies: 2
    Last Post: 02-18-2007, 06:59 PM
  6. [SOLVED] Auto fill multiple sections with different names
    By jerry in forum Excel General
    Replies: 1
    Last Post: 09-09-2005, 12:05 AM
  7. Auto Numbering
    By jharkins in forum Excel General
    Replies: 3
    Last Post: 07-28-2005, 08:05 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