+ Reply to Thread
Results 1 to 14 of 14

Sequential number in column but only if other column contains certain criteria

  1. #1
    Forum Contributor
    Join Date
    02-19-2020
    Location
    SE-Asia
    MS-Off Ver
    2019
    Posts
    126

    Sequential number in column but only if other column contains certain criteria

    See attached sheet

    Need your help again

    I want the Nr in Column A be filed sequential but only if Column E has a value of 1

    If Column E is another value then 1 (for example "adv" or 0) then Column A
    should stay Empty.

    I hope the example is clear

    Ps: Just for my understanding, can you please first give me a hint on how to solve this on my own, instead of ready made solution.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,776

    Re: Sequential number in column but only if other column contains certain criteria

    Are you still using Excel 2019?

    You can use COUNTIF with a dynamic range that will grow as you drag down (with the first cell in E anchored and the second not). Then all you need is an IF statement beforehand to put blanks in rows where E is 0.

    Tell me if yo uwant me to show you how.
    Last edited by AliGW; 12-15-2023 at 05:35 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,359

    Re: Sequential number in column but only if other column contains certain criteria

    Try, copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,776

    Re: Sequential number in column but only if other column contains certain criteria

    Trevor, the OP said this:

    Ps: Just for my understanding, can you please first give me a hint on how to solve this on my own, instead of ready made solution.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,359

    Re: Sequential number in column but only if other column contains certain criteria

    Another way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,359

    Re: Sequential number in column but only if other column contains certain criteria

    Ah, spoiler alert, missed that (twice)

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,776

    Re: Sequential number in column but only if other column contains certain criteria

    OK, well in that case, here's mine for good measure:

    =IF(E4=0,"",COUNTIF(E$4:E4,1))

  8. #8
    Forum Contributor
    Join Date
    02-19-2020
    Location
    SE-Asia
    MS-Off Ver
    2019
    Posts
    126

    Re: Sequential number in column but only if other column contains certain criteria

    Thx Guys and Gals,

    yes still using 2019 (Home and Student)

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,776

    Re: Sequential number in column but only if other column contains certain criteria

    You're welcome.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,359

    Re: Sequential number in column but only if other column contains certain criteria

    You're welcome.

  11. #11
    Forum Contributor
    Join Date
    02-19-2020
    Location
    SE-Asia
    MS-Off Ver
    2019
    Posts
    126

    Re: Sequential number in column but only if other column contains certain criteria

    Thx again guys and Gals.

    I made it a bit "better" (thanks to you guys), because if "adv" was showing it still showed the count for that cell (but did not increase it)

    Please Login or Register  to view this content.
    Last edited by iammike; 12-15-2023 at 11:04 PM.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,359

    Re: Sequential number in column but only if other column contains certain criteria

    In the solutions I offered, the test is for the cells in column E being 1.

    It would be easier to turn Ali's formula round:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For your region:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    02-19-2020
    Location
    SE-Asia
    MS-Off Ver
    2019
    Posts
    126

    Re: Sequential number in column but only if other column contains certain criteria

    Thx @TMS

    Way easier that, but I am very happy that my "solution" also works.

    May I ask is the OR solution less favorable?

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,359

    Re: Sequential number in column but only if other column contains certain criteria

    You're welcome. Thanks for the rep.

    May I ask is the OR solution less favorable?
    In that you have to check two conditions rather than one, yes, it is less favourable (IMO). What if there were other values you need to ignore? On the other hand, if you incremented the counter for more than one value, it wouldn't make much difference.

    It's your choice. The good thing is that you were able to adapt the solution yourself to handle the extra constraint.

+ 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. how to highlight more than one column after non sequential number/Date?
    By FakeFace in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-14-2023, 01:28 PM
  2. [SOLVED] Combine Column Values + Sequential Number to Create Smart ID Number
    By Nonoffensive Name in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-18-2020, 05:10 PM
  3. VBA - Insert next sequential number from series in a column
    By pingman3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2018, 02:01 AM
  4. [SOLVED] Summing row ranges based on non-sequential column criteria
    By TexasKersh in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-20-2014, 08:21 AM
  5. How to add sequential numbering down a column until the next number 1 and start over
    By diaphanous1138 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2014, 04:52 PM
  6. Replies: 10
    Last Post: 10-30-2013, 07:29 PM
  7. Replies: 1
    Last Post: 04-28-2006, 02:20 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