Search code examples
google-sheetsincrement

Google sheet - Increment if the text is the same as above


I'm searching how to auto increment the cell if the text is the same as above.

For exemple :

There is "Ball" in A1, and if there is "Ball" in A2, I want A2 to be "Ball - 2" etc.

I tried If function, and searching on internet but I couldn't find how to do it.


Solution

  • So, my problem was that I had a list with monster names:

    Monster list

    And then I had a drop box in which I can select the monsters in the above list. Thing is, if there were multiple times the same name in the list, the drop box showed only once the name of the monster.

    Dropbox

    So, I wanted the list to show like "Monster", "Monster 2", "Monster 3", etc.

    I took the formula of @player0 above:

    =INDEX(NB.SI.ENS(AB1:AB; AB1:AB; LIGNE(AB1:AB); "<="&LIGNE(AB1:AB)))
    

    …and put it in a corner of the sheet with others cells getting the value of the list:

    List

    Then on the first list I did:

    IF(AB1="N/A";"N/A";IF(AC1>1;AB1&" "& AC1;AB1))
    

    So now, my list is showing "Monster", "Monster 1", "Monster 2". etc, and so my drop box does too.

    Monster list working

    I think there may be easiest way to do it, but that's how I make it functional at the moment.