Forum Discussion

Leo Kim's avatar
Leo Kim
Copper Contributor
Sep 21, 2018

Changing numbers into negative or positive depending on the number condition

I have data in Excel that says 12.3 R, 30.2 L and things like that in 2 columns. It basically means 12.3 degree to the right and 30.2 degree to the left. All I want to do is change that into 12.3 and -30.2 instead of seeing R or L. How can I change that by using functions?

Thanks.

  • since you said you only have 2 columns,

    a simple way is to use helper column and a simple formula

    pls see attached file

    hope this helps

    thanks..

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor

    since you said you only have 2 columns,

    a simple way is to use helper column and a simple formula

    pls see attached file

    hope this helps

    thanks..

    • Leo Kim's avatar
      Leo Kim
      Copper Contributor

      This worked beautifully...Thank you. One additional question is, what if the character was 12R and not 12 R? Is there any change in the formula?

      • Lorenzo Kim's avatar
        Lorenzo Kim
        Bronze Contributor
        change the -2 to -1

        =IF(RIGHT(A1,1)="R",LEFT(A1,LEN(A1)-1)*1,LEFT(A1,LEN(A1)-2)*-1)

Resources