+ Reply to Thread
Results 1 to 15 of 15

Automatic numbering of rows if there is some text in adjacent cell - with one exception

  1. #1
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Red face Automatic numbering of rows if there is some text in adjacent cell - with one exception

    Hi,

    as a beginer I need to ask for help - I can´t find anywhere on the web how to make this into formula or vba macro (which is automaticly updating numbering, if anything changes):

    Automatic numbering of rows if there is some text in adjacent cell - with one exception - if there is text "XX" in adjacent cell, skip numbering of THIS ROW (leave cell blank) AND continue numbering.

    I think the picture explains it better:

    Bez názvu.jpg

    Thank for any advice
    Attached Images Attached Images

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    Put the number 1 in cell A1, then in A2 you can have this formula:

    =IF(OR(B2="",B2="XX"),"",MAX(A$1:A1)+1)

    then copy this down as far as you need to.

    Hope this helps.

    Pete

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,909

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    With data starting in row 2 and a1 blank

    in A2

    =IF(LEFT($B2,2)<>"xx",MAX($A$1:$A1)+1,"")

    Copy down

  4. #4
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    This works great! Thank you very much for your quick answer! I just had to change "," symbols for ";" symbols..is that problem of Office version or something else? Nevertheless thanks for solving this

  5. #5
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,140

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    No, it's your locale: in Europe and many other parts of the world you use ;, but in the UK, America, Australia and a few other places, we use ,.
    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.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    In many European countries the comma is used as a decimal point, and so to avoid confusion in Excel formulae you have to use a semicolon ( ; ) to separate different terms instead of the comma used in the UK and US. Sorry, I forgot to point that out in my earlier post.

    Pete

  7. #7
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Smile Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    Hi, I have encoutred more chalange in my project

    Idea is the same as before, only now I need to add one more exception.
    This was already very helpfuly answered:
    Automatic numbering of rows if there is some text in adjacent cell - with two exceptions:
    if there is text "XX" in adjacent cell, skip numbering of THIS ROW (leave cell blank) AND continue numbering.
    if there is nothing "" in adjacent cell, skip numbering of THIS ROW(leave cell blank) AND continue numbering.

    And now I need to add one more exception:
    if there is letter "o" in the beggining of the adjacent cell, skip numbering of THIS ROW (leave cell blank) AND continue numbering.


    Does this make sense? Thanks for any help in advance!
    Last edited by Cubajz; 08-09-2017 at 05:51 AM.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,909

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    Using Pete's formula (post #2)

    =IF(OR(B2="";B2="XX";LEFT(B2)="o");"";MAX(A$1:A1)+1)

  9. #9
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    Thank you!

  10. #10
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,140

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  11. #11
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    One more question Is there a way to make this formula look only for small letter "o" and not for big letter "O"?

    =IF(OR(B2="";B2="XX";LEFT(B2)="o");"";MAX(A$1:A1)+1)

    It is the last formula posted in this thread, I have encoutered problem with my project only now
    Again thank you for any advice.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,909

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    Try

    =IF(OR(B3="",B3="XX",CODE(LEFT(B3))=111),"",MAX(A$1:A2)+1)

  13. #13
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,140

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    The FIND function is case sensitive. Try this:

    =IF(OR(B2="";B2="XX");"";IF(ISERROR(FIND("o";LEFT(B2)));MAX(A$1:A1)+1;""))

  14. #14
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    Quote Originally Posted by AliGW View Post
    The FIND function is case sensitive. Try this:

    =IF(OR(B2="";B2="XX");"";IF(ISERROR(FIND("o";LEFT(B2)));MAX(A$1:A1)+1;""))
    Works! Thanks! Solved

  15. #15
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,140

    Re: Automatic numbering of rows if there is some text in adjacent cell - with one exceptio

    You're welcome!

+ 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. Replies: 1
    Last Post: 07-29-2015, 02:30 AM
  2. automatic numbering of rows in excel, how to?
    By Don in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2005, 07:05 PM
  3. [SOLVED] automatic numbering of rows in excel, how to?
    By Linda C. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  4. automatic numbering of rows in excel, how to?
    By Don in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2005, 05:05 PM
  5. automatic numbering of rows in excel, how to?
    By Linda C. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 PM
  6. [SOLVED] automatic numbering of rows in excel, how to?
    By Linda C. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM
  7. automatic numbering of rows in excel, how to?
    By Linda C. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11: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