Netsuite Custom formula split string - netsuite

I have a free-form text custom CRM field that is displayed as time that I would like to convert to a number in order to do basic arithmetic operations. The field is called {actualwork} and displays like this, 3:00. I want to divide it by a decimal number field called {custeven10} and display it in percent.
By using TO_NUMBER and SUBSTR I can convert the text to a number but the number of hours can be higher than a single digit so I don't know how to use the SUBSTR command to split my field. Right now I'm using this command but it only uses the first digit of the string.
TO_NUMBER(SUBSTR{actualwork},1,1))/{custevent10}
Does anyone know how I could separate the characters before and after the ":" into a two strings? Thank you for your time.

I used this formula to transform the text into number and separate the minutes and the hours:
(TO_NUMBER(SUBSTR({actualwork}, 1, LENGTH({actualwork})-3))+TO_NUMBER(SUBSTR({actualwork}, LENGTH({actualwork})-1,2))/60)/{custevent10}

Related

How to select a few numbers from a given number

If I have entered a certain 4 digit number for example ,1234 how do I choose like the first 2 numbers or the last two numbers from the cell by that i mean suppose i want it to return 34 for the last two digits and I want it to return 12 for the first two digits. So anytime I change my 4 digit number it works the same way.
You may use the LEFT and RIGHT functions, e.g.
=LEFT("1234", 2)
=RIGHT("1234", 2)
If your 4-digit number is, in fact, a string you can parse the string as suggested by #Tim Biegeleisen. In my Excel 365, when I enter 1234 in a cell formatted as General I can use the same method.
=LEFT(A1, 2)
and
=Right(A1, 2)
However, this conversion of a number to text mustn't be presumed to work under all circumstances. Therefore you may prefer to convert the number to text explicitly in the formula.
=LEFT(TEXT(A1,"0000"), 2)
and
=Right(TEXT(A1,"0000"), 2)
This method has the added advantage of being able to handle numbers of less than 4 digits.
On the other hand, you can also extract first and last digits from a true number, without converting it to text.
=INT(A1/100)
and
=MOD(A1,100)
The main difference is that the results are also numbers (all partial strings are text). Therefore this would be the preferred method if you don't want to worry about strings, text, numbers, numerics and cell formats.

How to extract string value based on delimiters

I need help with an Excel formula to extract a value from a string, based on delimiters.
This is the string I would like to extract the first 10 fields from: ES_ABC_FACEBOOK_SocialImage_FACEBOOK_Reach(CPM)_DEM_18-45_Apr19_abc_def_ghi
In other words, I would need to get ES_ABC_FACEBOOK_SocialImage_FACEBOOK_Reach(CPM)_DEM_18-45_Apr19_abc
Bearing in mind that the number of fields (separated by delimiters) may vary in the dataset but that I need to consistently only pick up the first 10 fields and drop however many fields are succeeding the 10th field.
Thanks in advance!
Robin
You could try this:
=LEFT(<your cell>,FIND("||",SUBSTITUTE(<your cell>,"_","||",10))-1)
e.g. =LEFT(A1,FIND("||",SUBSTITUTE(A1,"_","||",10))-1)
The formula finds the 10th underscore, and the gives you all the characters up to it (minus the underscore).
If you need to change how many fields it gives you back, change the 10. The -1 at the end just removes the final underscore. Of note, the || is just a simple set of characters I can't imagine will ever appear in your strings. If it does, something else will need to be selected.
Lastly, if some of your strings will have less than 10 fields, try:
=IF(ISERROR(FIND("||",SUBSTITUTE(<your cell>,"_","||",10))-1),<your cell>,LEFT(<your cell>,FIND("||",SUBSTITUTE(<your cell>,"_","||",10))-1))
This gives you the whole string in the event that there are less than 10 fields.
Hope that helps.

Calculating all number from a text file (division)

I have a file or a text which contains huge numbers. This is how it looks:
2622256647732477952, 3146707977278973440, 3776049572734768128, 4531259487281721344, 5437511384738065408, 6525013661685678080, 7830016394022813696, 9396019672827375616, 11275223607392849920, 13530268328871419904,
I want to divide every number by the factor of 100. Is there any fast way to do this? notepadd++ maybe? or any 3rd party editor which is able to do such stuff?
It's around 1000 numbers would be pretty time consuming to do this manually.
All the numbers seem to be integers. If that is true, and if they are all above 100 (the divisor), why not just use a regular expression to insert a decimal point in every number.
In Notepad++ try:
Search string: (\d+)(\d{2})
Replace string: $1.$2
Check "Regular expression" box and hit "Replace all".
Edit:
In the special case you mention in your comment, where the decimals should just be disregarded, you can simply use (\d+)\d{2} as search string and $1 as the replace string. Note that the result won't be rounded to the nearest integer though (11189 should become 112 really, but you'll get 111).
Other options include importing the string into Excel or other spreadsheet software and use a formula in there, writing a javascript snippet to split the string up and divide each number etc.

Sharepoint calculated field get number only

I have a SharePoint list with a field, Field A, holding values such as "Text-11" or "DifferentText-150" and I want a new calculated field, Field B, that only shows the numeric part of Field A (i.e. "11", "150").
The number can be between 1 and 9999 so I canĀ“t take always the last 2 digits.
Does anyone have an idea how to realize that with the calculated field function of SharePoint?
You will need to use several different functions to accomplish this. Your primary function will be MID which will allow you to grab a part of the original text but then you will also need to use SEARCH for your starting point and LEN to get the correct number of characters. Here are the steps for making your formula:
You will need the index of the first character in the number. This can be achieved by finding the first character after the dash ('-'). Remember that indexes in SharePoint calculated fields start at 1 and not 0.
SEARCH("-",[Title],1)
Next you need to get the length of the number part of your string. This can be achieved by getting the length of the whole string and subtracting the index of the dash ('-').
LEN([Title]) - SEARCH("-",[Title],1)
Finally you can get the number part of the string by using the MID function and passing in the index of the first character in the number (Part 1) and the length of the number part (Part 2).
MID([Title],SEARCH("-",[Title],1) + 1,LEN([Title]) - SEARCH("-",[Title],1))
Note: Title is just the name of the test column that I used.

Excel Number Formatting

I'm currently working on a sheet that contains part numbers in it. I'd like them to be formatted like this:
####-#####-XX
Where #s can be letters or numbers, #s are numbers, and Xs are letters.
I run into two problems while doing this. The first is that I can't figure out how to handle text and numbers at the same time in the Custom Format dialog box. The second is that occasionally a part number will have 3 letters after the second hyphen rather than 2, and I can't figure out how I should structure the condition to differentiate between the two formats.
How can I handle numbers and text at the same time when creating a custom format, and how can I add the condition described above (based on character numbers or something)?
Thanks.
If can't be achieved with custom formatting then a formula such as below may suit:
=LEFT(A1,4)&"-"&MID(A1,5,5)&"-"&RIGHT(A1,LEN(A1)-9)
If the middle number section has to be 5 digits, use
#-0000#-XX
But I don't think number formats are designed to handle Alphanumeric entries, and I can't help you with those X's

Resources