Replace letter by its position in alphabet

Hi, I need to convert letters to their position in the alphabet. So A becomes 1, B → 2, C → 3 etc…

Does Airtable have a function to do that?

I’d like to avoid the multiple IF statements :upside_down_face:

Thank you

Welcome to the Airtable community!

No, Airtable does not have a built in function that converts a letter to a number. If you know that the field will have only a single letter, you can use a SWITCH statement instead of nested IFs.

SWITCH( {field name},
  "A", 1,
  "B", 2,
  "C", 3,
  ...
  "Z", 26
)

If your field will have multiple letters, you can use 26 nested SUBSTITUTE() functions. Note that the result will be a string that looks like a number, but not an actual number unless you wrap a VALUE() function around it.

3 Likes

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.