A formula to return characters between text and the next semicolon in a cell

Column A always contains the information "PLAN 1234;"

  • The semicolon is always the third semicolon.
  • The plan numbers are alphanumeric and can be any length.

I need to return just the plan number without "PLAN " but not sure what I'm misunderstanding about how to use FIND, LEN, etc. I can get the individual functions to work but not when I combine them.

Best Answers

  • Coffee
    Coffee ✭✭✭
    Answer ✓

    This worked:

    =MID(A@row, FIND("PLAN ", A@row) + 5, VALUE(FIND(";", A@row, FIND("PLAN ", A@row))) - VALUE(FIND("PLAN ", A@row) + 5))

  • ker9
    ker9 ✭✭✭✭✭✭
    Answer ✓

    Hi @Coffee

    See if this works for you, presuming that "PLAN " always appears before the number.

    =MID(LEFT([Column1]@row, FIND(CHAR(1), SUBSTITUTE([Column1]@row, ";", CHAR(1), 3)) - 1), FIND("PLAN ", [Column1]@row) + 4, LEN([Column1]@row))

    Change [Column1] to the name of your column.

    Hope this helps!

Answers

  • Coffee
    Coffee ✭✭✭

    In case it helps, this my last attempt:

    =MID(A@row, FIND("PLAN ", A@row) + 5, LEN(RIGHT(A@row, LEN(A@row) - VALUE(FIND(";", A@row, FIND(";", A@row, FIND(";", A@row)))))))


    This is starting in the right place but I don't know how to get it to end at the third semicolon in the cell/first semicolon after "PLAN "

  • Coffee
    Coffee ✭✭✭
    Answer ✓

    This worked:

    =MID(A@row, FIND("PLAN ", A@row) + 5, VALUE(FIND(";", A@row, FIND("PLAN ", A@row))) - VALUE(FIND("PLAN ", A@row) + 5))

  • ker9
    ker9 ✭✭✭✭✭✭
    Answer ✓

    Hi @Coffee

    See if this works for you, presuming that "PLAN " always appears before the number.

    =MID(LEFT([Column1]@row, FIND(CHAR(1), SUBSTITUTE([Column1]@row, ";", CHAR(1), 3)) - 1), FIND("PLAN ", [Column1]@row) + 4, LEN([Column1]@row))

    Change [Column1] to the name of your column.

    Hope this helps!

  • Coffee
    Coffee ✭✭✭

    That works! Thank you!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!