1

I'm trying to make a worksheet where one column automatically numbers based on the value of another cell.

If the cell in the first column says 'MSG', the value in the next cell, should be something like MSGRA15_00001, if in another row, the first cell is also MSG, the value in the next cell should become MSGRA15_00002.

If the value in the first column says SEL the returned value in the next column should be SELRA15_00001 and so on...

Cell numbering based on previous cell

Can anyone help me on this?

Thanks a lot!

akardon
  • 43,164
  • 4
  • 34
  • 42

1 Answers1

1

Assuming your MSG/SEL-column is in range A1:A?, you can paste

=A1&"RA15_"&TEXT(COUNTIF(A$1:A1;A1);"00000")

Into B1 and then copy and paste it from there.

Ulli Schmid
  • 1,167
  • 1
  • 8
  • 16
  • This works great! Thanks! Is there a way to keep the empty rows blank? If the cell in the A column is empty, than the cell in the B column says 'RA15_00000' – Steve Noyelle Jul 26 '16 at 13:08
  • you could wrap the existing code with an isempty() check. the cell will then not be empty, however, but an empty string (""). Code for B1: =IF(ISEMPTY(A1);"";A1&"RA15_"&TEXT(COUNTIF(A$1:A1;A1);"00000")) – Ulli Schmid Jul 26 '16 at 13:39
  • 2
    Hey, Thank you for your help, this worked for me: =IF(A2="";"";A2&"RA15_"&TEXT(COUNTIF(A$2:A2;A2);"00000")) Thank you very much! :) – Steve Noyelle Jul 26 '16 at 13:59