Split string in 2 column

I have a field called "Location" in this field we are storing "City, State". Now we want to show city in other column and state in other column. Basically I want to split the "Location" column based on "," (comma).

To achieve this goal I am using the functions:


Let’s see how can we do this with use of above given functions.

If Errors, I am using ISERROR formula
=IF (ISERROR (currentFormula), "", currentFormula)

I am going to create a calculated column called "City" and copy & paste the "=IF(ISERROR(LEFT(Location,(SEARCH(",",Location,1)-1))), "", TRIM(LEFT(Location,(SEARCH(",",Location,1)-1))))" in the formula text box. This formula will check whether any error is coming or not if error is coming then it will return blank value otherwise show us "City Name"


I am going to create a calculated column called "State" and copy & paste the "=IF(ISERROR(RIGHT(Location,(LEN(Location)-SEARCH(",",Location,1)))), "", TRIM(RIGHT(Location,(LEN(Location)-SEARCH(",",Location,1)))))" in the formula text box. This formula will check whether any error is coming or not if error is coming then it will return blank value other wise show us "State Name"

Comments

sappai said…
If there are multiple values would these forumlas work

Ex
Value1,value2,value3,value4,value5,

Popular Posts

SharePoint Interview Questions and Answers

Download Infopath Form Templates

How to get current logged user information using JavaScript ?

Steps to set Form based authentication (FBA) for SharePoint 2010

SharePoint Interview Questions and Answers II

Get List Items - JavaScript

Change Language for current user with JSOM in SharePoint Online

Cross Site List Rollup Web Part for SharePoint 2010

Hide Recently Modified Items

SharePoint 2010 CSS Chart