Matt Pinkston
asked on
SharePoint Calculated Field or Workflow to Substring
In my SharePoint custom list I need to look at a field called "Subject" and substring a certain portion of it into another field I would like to call RAPTID
Lets say the contents of the field Subject is
AGR NETC-5000-2016-NG2580 XXXX MPTE
I would need to find a way to get NETC-5000-2016-NG2580 into its own variable. Start and end locations will not always be the same but the beginning would be NETC- and the end would be the first space after that.
I am fine with Calculated field or Workflow but the calculated field would likely be quicker (instant)
Lets say the contents of the field Subject is
AGR NETC-5000-2016-NG2580 XXXX MPTE
I would need to find a way to get NETC-5000-2016-NG2580 into its own variable. Start and end locations will not always be the same but the beginning would be NETC- and the end would be the first space after that.
I am fine with Calculated field or Workflow but the calculated field would likely be quicker (instant)
ASKER
is that a calculated field style in SP2010?
ASKER
I had a slight change
Lets say the contents of the field Opportunity Name is
AGR NETC-5000-2016-NG2580 XXXX MPTE
I would need to find a way to get NETC-5000-2016-NG2580 into its own variable. Start and end locations will not always be the same but the beginning would be -NG and the end would be the first space after that. So in the case above NG2580
Not all Opportunity Names would have a -NG
And tried
=IF(ISERR(FIND("-NG";[Oppo rtunity Name]));"";MID([Opportunit y Name];FIND("-NG";[Opportun ity Name]);FIND(" ";[Opportunity Name]&" ";FIND("-NG";[Opportunity Name]))-FIND("-NG";[Opport unity Name])))
Which gave me an error
Lets say the contents of the field Opportunity Name is
AGR NETC-5000-2016-NG2580 XXXX MPTE
I would need to find a way to get NETC-5000-2016-NG2580 into its own variable. Start and end locations will not always be the same but the beginning would be -NG and the end would be the first space after that. So in the case above NG2580
Not all Opportunity Names would have a -NG
And tried
=IF(ISERR(FIND("-NG";[Oppo
Which gave me an error
ASKER
maybe what would make it easier is the substring would start where -NG begins plus one and always go for 6 characters
ASKER
Using the following:
=RIGHT([Opportunity Name],LEN([Opportunity Name])-INT(FIND("-NG",[Opp ortunity Name])))
Opportunity Name = PMNMCI-5000-2015-NG1270 - Tier 3 Field Service Support
Result is - NG1270 - Tier 3 Field Service Support
Now I need to figure out how to get on the 6 characters NG1270
AND when -NG does not exist I don't want #VALUE!
=RIGHT([Opportunity Name],LEN([Opportunity Name])-INT(FIND("-NG",[Opp
Opportunity Name = PMNMCI-5000-2015-NG1270 - Tier 3 Field Service Support
Result is - NG1270 - Tier 3 Field Service Support
Now I need to figure out how to get on the 6 characters NG1270
AND when -NG does not exist I don't want #VALUE!
Check this:
=MID([Opportunity Name];INT(FIND("-NG";[Oppo rtunity Name]));FIND(" ";[Opportunity Name]&" ";FIND("-NG";[Opportunity Name]))-FIND("-NG";[Opport unity Name]))
=MID([Opportunity Name];INT(FIND("-NG";[Oppo
ASKER
when I put
=MID([Opportunity Name];INT(FIND("-NG";[Oppo rtunity Name]));FIND(" ";[Opportunity Name]&" ";FIND("-NG";[Opportunity Name]))-FIND("-NG";[Opport unity Name]))
In the calculated field I get an error
The formula contains a syntax error or is not supported.
=MID([Opportunity Name];INT(FIND("-NG";[Oppo
In the calculated field I get an error
The formula contains a syntax error or is not supported.
Replace ; with ,
ASKER
Getting some weird results
Opportunity Name=PMNMCI-5000-2015-NG12 70 - Tier 3 Field Service Support
XID=-NG1270 should be just NG1270
Opportunity Name=PMNMCI-5000-2015-NG05 90-MOD3 ORT HBSS 4.6 Upgrade Mod 3
XID=-NG0590-MOD3 should be just NG0590
Opportunity Name=MPTE Tier 1 Managed Print Services
XID=#VALUE! should be just "BLANK"
Opportunity Name=PMNMCI-5000-2015-NG12
XID=-NG1270 should be just NG1270
Opportunity Name=PMNMCI-5000-2015-NG05
XID=-NG0590-MOD3 should be just NG0590
Opportunity Name=MPTE Tier 1 Managed Print Services
XID=#VALUE! should be just "BLANK"
ASKER
=MID([Opportunity Name];INT(FIND("-NG";[Oppo rtunity Name]));FIND(" ";[Opportunity Name]&" ";FIND("-NG";[Opportunity Name]))-FIND("-NG";[Opport unity Name]))
Did not solve the issue, gave unexpected results see below
Opportunity Name=PMNMCI-5000-2015-NG12 70 - Tier 3 Field Service Support
XID=-NG1270 should be just NG1270
Opportunity Name=PMNMCI-5000-2015-NG05 90-MOD3 ORT HBSS 4.6 Upgrade Mod 3
XID=-NG0590-MOD3 should be just NG0590
Opportunity Name=MPTE Tier 1 Managed Print Services
XID=#VALUE! should be just "BLANK"
Did not solve the issue, gave unexpected results see below
Opportunity Name=PMNMCI-5000-2015-NG12
XID=-NG1270 should be just NG1270
Opportunity Name=PMNMCI-5000-2015-NG05
XID=-NG0590-MOD3 should be just NG0590
Opportunity Name=MPTE Tier 1 Managed Print Services
XID=#VALUE! should be just "BLANK"
The first parameter of MID() function is the source string. Second parameter is the starting position in the source string. When you look for a string starting with a dash and you do not want to copy the dash then simply increase the starting position by one.
If you do not want to have #VALUE error messages if starting position is invalied because your search string is missing then use my check in my first version.
And best is when you do that all alone and learn by doing ;- )
Or do you need more explanation?
Oh, the third parameter in MID() function is length of extracted string. If you want to search for single words delimeted by space OR dash char then you need to find the separator by checking twice and choosing the first match.
Like this:
=IF(ISERR(FIND("-NG";[Oppo rtunity Name]));"";MID([Opportunit y Name];FIND("-NG";[Opportun ity Name])+1;MINA(FIND(" ";[Opportunity Name]&" ";FIND("-NG";[Opportunity Name]))-1;FIND("-";[Opport unity Name]&"-";FIND("-NG";[Oppo rtunity Name])+1)-1))))
If you do not want to have #VALUE error messages if starting position is invalied because your search string is missing then use my check in my first version.
And best is when you do that all alone and learn by doing ;- )
Or do you need more explanation?
Oh, the third parameter in MID() function is length of extracted string. If you want to search for single words delimeted by space OR dash char then you need to find the separator by checking twice and choosing the first match.
Like this:
=IF(ISERR(FIND("-NG";[Oppo
Here the link to list of available functions:
https://sharepointdiva.wordpress.com/2012/09/06/text-formulas-for-the-calculated-column/
https://sharepointdiva.wordpress.com/2012/09/06/text-formulas-for-the-calculated-column/
My last version has missmatch in closing braces.
Here the corrected and extended version:
=IF(ISERR(FIND("-NG";[Oppo rtunity Name]));"";MID([Opportunit y Name];FIND("-NG";[Opportun ity Name])+1;MINA(FIND(" ";[Opportunity Name]&" ";FIND("-NG";[Opportunity Name]))-FIND("-NG";[Opport unity Name])-1;FIND("-";[Opportu nity Name]&"-";FIND("-NG";[Oppo rtunity Name])+1)-FIND("-NG";[Oppo rtunity Name])-1)))
Here the corrected and extended version:
=IF(ISERR(FIND("-NG";[Oppo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
AWESOME!!!!
One last question...
Is there a way in the formula when you look at -NG that the next column -NGX X has to be numeric???
One last question...
Is there a way in the formula when you look at -NG that the next column -NGX X has to be numeric???
ASKER
AWESOME.... Thanks for the help!!!!!
Thank you for grading : )
Can you please open a new Question and post the examples and expected results?
Can you please open a new Question and post the examples and expected results?
Open in new window