Sharepoint calculated field get number only - sharepoint

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.

Related

How to custom sort strings and numbers in VBA

I'm trying to sort a column in my excel spreadsheet that contains numbers ,strings and "empty". My goal is to sort the numbers descending, followed by empty, followed by strings descending as well.
Sample data with 4 rows is in the table below.
Columns("A:A").Sort key1:=Range("A2"), order1:=xlDescending
With a normal column sort, I can get the numbers and the "empty" in the right order (Failed Code). However, the String keeps on appearing before the numbers when sorting descending.
Initial Failed_Code Desired_Output
1 6566 String 6566
2 6566 700
3 700 700
4 String String
Normally you can specify the sorting order in a list and use the OrderCustom parameter of VBA sort, an example is in the accepted answer of Code an Excel VBA sort with a custom order and a value containing commas. However as you are sorting integers and strings the usually adviced helper/auxiliary column ( Custom sort in Excel by first character and user-defined non-alphabetical order., ) is an easier solution here too, especially as in custom lists no wildcards are possible (https://www.mrexcel.com/board/threads/custom-sort.471612/).
As ! is the first character following the control characters in ASCII table and Windows sorting order (What is the first character in the sort order used by Windows Explorer?) write a macro that creates the auxiliary column according to the first character in the cells you want to sort (How to check first character in a cell value), if this first character is a letter prepend an !, then sort by the auxiliary column in descending order.
An alternative an possibly easiest solution, would be in your case to first sort the entire column ascending, then determine the index where is the 'border' between integers and strings by checking the first character (How to check first character in a cell value) and then sort the integers and strings separately descending, because you can always specify the sorting range you do not have to necessarily sort tte entire column.

Netsuite Custom formula split string

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}

Count the number of individual entries in a cell

Is it possible to count the number of individual entries in a cell?
For example 2+2+4-1 = 4 entries
Using the count formula counts the entries as 1
I want to calculate the number of adjustments made in a particular period.
Each +/- in an individual cell represents 1 adjustment.
Assuming you're referring to a text cell, the trick is to count the symobols you'd like to find. Before we dig into that, if you want to enter this data as text, you can use the ` symbol (Usually to the left of the 1 key on your keyboard) before entering your text to make sure it gets processed as text.
If you want to verify that it is text, you can use the TYPE function and look for a return result of 2 (check the link for other possible return types)
There are no direct functions to count characters in Excel, so the trick is to find the length of the original text and subtract it from the length of a new text where you have removed all of the special characters. You mentioned you were trying to count the entries (i.e. the numbers), but you said your goal was to ultimately count the number of '+/-' operations. Since counting numbers can be tricky with excel formulas (since we'll get hung up on 2 and 3 digit numbers), I am going to approach this problem from the perspective of counting the operations you are looking for. So here is a basic example:
length("2+1") = 3
- length("21") = 2 (we replaced the + with "" [blank])
= 1
So we know there is 1 '+' since we replaced it. The appropriate functions used to accomplish this are LEN and SUBSTITUTE
Since you can only find one symbol at a time using the SUBSTITUTE function, we must take the output of the first formula, and give it to the second formula, and so on and so forth. Ultimately, we can put together as many functions as we need to achieve the desired result.
So we start with + for your example (And assuming your data is in A1)
=LEN(A1)-LEN(SUBSTITUTE(A1,"+",""))
which gives us a result of 2. But we also need to find the - symbol. So we wrap another SUBSTITUTE:
=LEN(A1)-LEN(SUBSTITUTE(SUBSTITUTE(A1,"+",""),"-",""))
You have said you wanted to count the number of +/- in the cell, and this does accomplish that, but if you want to expand it to more mathematical operators, you simply add more SUBSTITUTE functions (here is a complete function where I've added * and /)
=LEN(A1)-LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"+",""), "-",""),"*",""),"/",""))
Well, this formula would replace all your numbers with "" and then Count the +/- and adds one, should do it, but is ugly:
=LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1;"0";"");"1";"");"2";"");"3";"");"4";"");"5";"");"6";"");"7";"");"8";"");"9";""))+1
Could probably be done with RegEx, but I don't know how to do that in formulas
This makes 31+12+3-4 to ++-, Counts the LEN (3) and adds 1

Correlate the Boundary value in Load Runner 12.5

I am using loadrunner 12.5. In the below value I need to correlate and get the value 1aqeid!None (the None will also be filled with numbers so its dynamic)
Example:
1. {id:'1aqeid!None!123456',paramName:'jsessionId'};
2. {id:'1aqeid!zxsjfn12536782ldfj!123456',paramName:'jsessionId'};
I need to get only the below value
1. 1aqeid!None
2. 1aqeid!zxsjfn12536782ldfj
web_reg_save_param("ID","LB=id:'","RB=!","ORD=1",LAST);
I am not able to find the solution.
"LB={id:'",
"RB=',paramName:'jsessionID'",
"ORD=ALL",
LAST
This will leave you with:
1aqeid!None!{some value you do not need}
You have a number of options at this point. You could use strtok() and split your string with a '!' as a separator, you could parse the string to find the location of the second instance of the '!' in the character array and then take a substring using strncpy() before that as your value, or..... The point here is that you can collect more than you need and then trim down based upon a known separator in the data.

Sorting of links with numbers in Excel

I have a list of similiar links of website with equal base in Excel. At the and of the link there is numbers, e.g. *_100, *_1013, *_14 and so on.
I need to sort the list descending like
*_1013
*_100
*_14
(first 4-digit links, then 3-digit, then 2-digit)
Is there any possibility in Excel to sort this array in right way?
From your question the "*_XXX" is at the end of the string. So to get the values you need to
Indentify where the *_ occurs and extract that
Remove the *- from the extracted string (which I used SUBSTITUTE to do), then convert it to a value
=IFERROR(VALUE(SUBSTITUTE(RIGHT(A1,LEN(A1)-FIND("*_",A1)-1),"*_","")),"no match")
If you don't mind an extra column you can extract the number, make it a real number with =value() and then simply sort largest to smallest. (note: prepending 0s, if any exist, would be lost during call to value function)

Resources