🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

String to Numeric

User: "Andy_21788"
Altair Community Member
Updated by Andy_21788
​​Hi all

I have a file that's got a column of numbers stored as strings.  Where a number is negative, rather than it showing in the usual way, it's shown with an "R" (for refund) after the numerals - so 6.80R for example.  I've been trying to create a calculated field that'll manipulate those strings so that I can then convert the whole column to numbers, including negatives,  rather than characters but I'm not getting anywhere.  Does anyone have any suggestions please?

Thanks

Andy


------------------------------
Andy Coles
Pension Manager
Dorset Healthcare University NHS Foundation Trust
01305 361302
------------------------------

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Steve_Caiels"
    Altair Employee
    Accepted Answer
    Updated by Steve_Caiels
    Hi Andy,

    Starting with the 6.80R in a character field called [MyField], for example.  Create a numeric calculated field and try the following:

    If(Right([MyField],1) = "R",Val([MyField]) * -1,Val([MyField]))

    Regards,
    Steve.


    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-02-2019 12:04 PM
    From: Andy Coles
    Subject: String to Numeric

    Hi all

    I have a file that's got a column of numbers stored as strings.  Where a number is negative, rather than it showing in the usual way, it's shown with an "R" (for refund) after the numerals - so 6.80R for example.  I've been trying to create a calculated field that'll manipulate those strings so that I can then convert the whole column to numbers, including negatives,  rather than characters but I'm not getting anywhere.  Does anyone have any suggestions please?

    Thanks

    Andy


    ------------------------------
    Andy Coles
    Pension Manager
    Dorset Healthcare University NHS Foundation Trust
    01305 361302
    ------------------------------"