+ Reply to Thread
Results 1 to 7 of 7

How can i to return the row number of the last repeated text in a column?

  1. #1
    Registered User
    Join Date
    08-25-2012
    Location
    Goiania
    MS-Off Ver
    Excel 2013 64 bits
    Posts
    10

    Question How can i to return the row number of the last repeated text in a column?

    Hello,

    I want to get the following:

    B C
    John
    Maria
    Nelson
    John 1
    Alex
    George
    John 4

    In other words: I need an formula on Cx that display the row number of last occurence of text in Bx prior to Bx.

    Can anyone help me?

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: How can i to return the row number of the last repeated text in a column?

    In C1:

    =IF(COUNTIF($B$1:B1,B1)>1,MATCH(B1,B:B,0),"")

    Edited to add: That will always return the row of the first occurrence, sorry, what you probably want is:

    =IF(COUNTIF($B$1:B1,B1)>1,MAX(INDEX(ROW($B$1:B1)*($B$1:B1=B1)*(ROW($B$1:B1)<ROW(B1)),0)),"")
    Last edited by Andrew-R; 08-25-2012 at 12:10 PM.

  3. #3
    Registered User
    Join Date
    08-25-2012
    Location
    Goiania
    MS-Off Ver
    Excel 2013 64 bits
    Posts
    10

    Re: How can i to return the row number of the last repeated text in a column?

    Affirmative.

    I'm using an Portuguese version of Excel. I made a few modifications on your formula that worked fine: =SE(CONT.SE($B$1:B2;B2)>1;CORRESP(B2;$B$1:B2;0)+1;"") .

    Thank You very much!

  4. #4
    Registered User
    Join Date
    08-25-2012
    Location
    Goiania
    MS-Off Ver
    Excel 2013 64 bits
    Posts
    10

    Re: How can i to return the row number of the last repeated text in a column?

    Quote Originally Posted by Andrew-R View Post
    In C1:

    Edited to add: That will always return the row of the first occurrence, sorry, what you probably want is:

    =IF(COUNTIF($B$1:B1,B1)>1,MAX(INDEX(ROW($B$1:B1)*($B$1:B1=B1)*(ROW($B$1:B1)<ROW(B1)),0)),"")
    Affirmative, in my previous post I was wrong. Seeing your edit now I found the correct answer:

    a) Excel 2010 PT: =SE(CONT.SE($A$1:A1;A1)>1;MÁXIMO(ÍNDICE(LIN($A$1:A1)*($A$1:A1=A1)*(LIN($A$1:A1)<LIN(A1));0));"")

    b) Excel 2010 EN: =IF(COUNTIF($A$1:A1,A1)>1,MAX(INDEX(ROW($A$1:A1)*($A$1:A1=A1)*(ROW($A$1:A1)<ROW(A1)),0)),"")

    All correct??

    Thanks!

  5. #5
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: How can i to return the row number of the last repeated text in a column?

    Looks good, although my Portuguese is ... well, non-existent

  6. #6
    Registered User
    Join Date
    08-25-2012
    Location
    Goiania
    MS-Off Ver
    Excel 2013 64 bits
    Posts
    10

    Re: How can i to return the row number of the last repeated text in a column?

    Quote Originally Posted by Andrew-R View Post
    Looks good, although my Portuguese is ... well, non-existent
    Looks bad, Brazil is offering many job & business opportunities for foreigners.

    Marking topic as solved.

    Thanks!

  7. #7
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: How can i to return the row number of the last repeated text in a column?

    There's a slim chance I'll get to visit Brazil for the 2016 Olympics. In the meantime, happy to help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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