C2 contains text that may or may not begin, end, or end&begin with a comma. The text may also have commas in the middle. I want to only strip the commas if they appear on either end.
,foo,bar, -> foo,bar
,foo,bar -> foo,bar
foo,bar, -> foo,bar
,, ->
I've been able to accomplish this task with multiple cells, but I figure somebody else could greatly improve upon my feeble attempt.
In B2 I use =IF(RIGHT(C2,1)=",",REPLACE(C2,LEN(C2),1,""),C2) to strip off trailing commas and
In A2 I use =IF(LEFT(B2,1)=",",REPLACE(B2,1,1,""),B2) to strip off leading commas.
In general I'm having trouble figuring out how to have multiple IFs work against a text string.
TIA.
,foo,bar, -> foo,bar
,foo,bar -> foo,bar
foo,bar, -> foo,bar
,, ->
I've been able to accomplish this task with multiple cells, but I figure somebody else could greatly improve upon my feeble attempt.
In B2 I use =IF(RIGHT(C2,1)=",",REPLACE(C2,LEN(C2),1,""),C2) to strip off trailing commas and
In A2 I use =IF(LEFT(B2,1)=",",REPLACE(B2,1,1,""),B2) to strip off leading commas.
In general I'm having trouble figuring out how to have multiple IFs work against a text string.
TIA.