- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to convert char to num
Dear All,
I have the data as follows and whatever I tried I can't make the new formula column a numeric one.
Could someone help please?
many thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
To get a slightly simpler formula, use multiple arguments in Substitute().
For example:
Substitute(:Comment, "!", " ", "+", " ", "%", " ", "_", " ", "-", " ", "?", " ");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
Thank you MS,
Thank you jvillaumie,
Both work very well !
I am continuously checking the tutorials, books, help, webcasts but sometimes when it comes to action some very simple thing is missing. In this example I knew the Substitute function but did not know it could be surrounded by another Substitute and another and another and by collapse whitespace and lowercase functions...
Many many thanks again, it saved me 8 minutes for each day of my rest life...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
Dear all,
again to same topic this time I can not create a formula column which divides the first number by second number (4/5, 44./5, 7.3/10...etc...)
Substraction does not work cos no equal lenght, Substitute is not a way to go Words can not seperate the characters....
many thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
I have not read the whole thread. But perhaps this is close (if you can depend on the 'divide' delimiter):
New Table( "Convert Char Fraction",
Add Rows( 4 ),
New Column( "Char Fraction",
Character,
"Nominal",
Set Values( {"4 / 5", "3/2", "27/ 26", "122 /37.6"} )
),
New Column( "Result",
Numeric,
"Continuous",
Format( "Fixed Dec", 12, 3 ),
Formula(
Num( Trim( Word( 1, :Char Fraction, "/" ) ) ) /
Num( Trim( Word( 2, :Char Fraction, "/" ) ) )
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
Saitcopuroglu,
You should be able to use the following formula:
Num(Word(1,:Score, "/"))/Num(Word(1,:Score, "/"))
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
Many thanks, both work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to convert char to num
Given all the questions, and the length of this post. I'm just going to let you know, it'd be worth the hour of your time to study regular expressions. Regular expressions are a very common programming technique that is universal and can be found in almost all programming languages. Regular expressions can do everything above and more.
The JSL Scripting guide has a very good subsection that should cover all you need to know about the regex() function. And there are plenty of YouTube videos that go in depth as well.
- « Previous
- Next »