Calculated Column
Folks:
I have a calculated column which get the name of the Accountant from the string.
String (Email Subject):
Accountant#XYZ#JOE#03/11/2011
Accountant#PQR#JOHN#03/11/2011
Accountant#ABC#MARY#03/11/2011
Using this formula (below) I am able to seperate the first name in the string (after Accountant). I would like to know how could I seperate the 2nd name (before start of date):
=MID([E-Mail Subject],FIND("#",[E-Mail Subject],1)+1,FIND("#",[E-Mail Subject],FIND("#",[E-Mail Subject],1)+1)-FIND("#",[E-Mail Subject],1)-1)
The output we get for 1st column as expected is:
XYZ
PQR
ABC
We would also like to get the 2nd name in the string to populate the 2nd column.
JOE
JOHN
MARY
Thanks !
May 23rd, 2011 9:38am
I'd suggest using a different approach to make this a little more simple... but that's just because I'm pretty simple... so...
Using Split you can turn the string into an array....
myString = "Accountant#XYZ#JOE#03/11/2011";
myArray = myString.split('#');
result:
myArray[0] = Accountant
myArray[1] = XYZ
myArray[2] = JOE
myArray[3] = 03/11/2011
Hope this helps,
MarkThe SharePoint Hillbilly
Fewer Big Words... More Pretty Pictures...
http://www.SharePointHillbilly.com
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2011 9:44am
For some reason this does not work when I replaced it with your formula. I get this error.
The formula contains a syntax error or is not supported. at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(String bstrUrl, String bstrListName, String bstrXML)
at Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)
Also, because we are storing the different values in different columns so how can I use this? I'm new to SharePoint so this might sound weird question but any help is appreciated.
Thanks !
May 23rd, 2011 10:08am
sorry.. my bad... this was in the development and programming forum, I thought you were asking how to pull these out in Visual Studio... after retrieving the value from the calculated column...
Monday morning... I apologize... let me dig into this now that I'm over my duh moment.
MarkThe SharePoint Hillbilly
Fewer Big Words... More Pretty Pictures...
http://www.SharePointHillbilly.com
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2011 10:13am
So, are you asking how to return "JOE XYZ" in one calculated column?The SharePoint Hillbilly
Fewer Big Words... More Pretty Pictures...
http://www.SharePointHillbilly.com
May 23rd, 2011 11:21am
I'm asking is how to return JOE in one calculated column from this string.
Accountant#XYZ#JOE#03/11/2011
Thanks !
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2011 11:25am
So... the way I got it to work I'm guessing the formula is too long to fit in one calculated column...
So I had to use two...
formula for first column called "calcColumn1" (Where 'Title' is my string field) =
RIGHT(RIGHT(Title,LEN(Title)-FIND("#",Title,1)),LEN(RIGHT(Title,LEN(Title)-FIND("#",Title,1)))-FIND("#",RIGHT(Title,LEN(Title)-FIND("#",Title,1)),(FIND("#",RIGHT(RIGHT(Title,LEN(Title)-FIND("#",Title,1)),LEN(RIGHT(Title,LEN(Title)-FIND("#",Title,1)))-FIND("#",RIGHT(Title,LEN(Title)-FIND("#",Title,1)),1)),1))))
This returns:
JOE#03/11/2011
Formula for second calculated column:
=LEFT(calcColumn1,FIND("#",calcColumn1)-1)
This returns:
Joe
Maybe someone else has a more elegant formula? I'm not a calculated columns guru...
Hope this helps!
MarkThe SharePoint Hillbilly
Fewer Big Words... More Pretty Pictures...
http://www.SharePointHillbilly.com
May 23rd, 2011 12:21pm
Hi There,
This one works with one calculated field
LEFT(RIGHT([E-Mail Subject],LEN([E-Mail Subject])-FIND("#",[E-Mail Subject],FIND("#",[E-Mail Subject])+1)),FIND("#",RIGHT([E-Mail Subject],LEN([E-Mail Subject])-FIND("#",[E-Mail Subject],FIND("#",[E-Mail Subject])+1)))-1)
- Xenox G.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2011 12:33pm
This works..... Thanks Xenox and Mark for your help !
May 23rd, 2011 3:30pm