Forum Discussion

robindspain's avatar
robindspain
Copper Contributor
Mar 25, 2023
Solved

Using If function to check text and return numerical value

Hi community,

I am tryng to create a formula, failing miserably, to read a certain text string and then return a numerical value depending on the text in the cell.

 

Any ideas would be greatly received.

  • robindspain

    You should create a list with two columns - the first containing the letters and the second the corresponding number:

    A 10
    F 20

    Select the list, click in the name/address box on the left hand side of the formula bar, enter a name, for example List, and press Enter.

     

    With a letter in cell A1, you can then use the formula

    =IFERROR(VLOOKUP(A1, List, 2, FALSE), "")

4 Replies

    • robindspain's avatar
      robindspain
      Copper Contributor

      HansVogelaar 

      If I have a specific letter or word in a cell I want to be able to create a formula in another cell to return a specific numerical value depending on the letter.

       

      For example if cell A1 contains the letter C then in cell A2 the formula would return a value of 10.

      If the letter was F then a value of 20 and so on.

       

      Hope this makes it a bit clearer.

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        robindspain

        You should create a list with two columns - the first containing the letters and the second the corresponding number:

        A 10
        F 20

        Select the list, click in the name/address box on the left hand side of the formula bar, enter a name, for example List, and press Enter.

         

        With a letter in cell A1, you can then use the formula

        =IFERROR(VLOOKUP(A1, List, 2, FALSE), "")

Resources