Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

if and replace function?

11 views
Skip to first unread message

jc99...@yahoo.com

unread,
May 22, 2013, 1:57:40 PM5/22/13
to
Hello
I need help
I have names on my left and depending on the name I need to remove a space

Original data Answer
John, Repp John,Repp
Jay, Thorp Jay, Thorp
Jana, Washington Jana,Washington

So just depending on the name some need the space after the "," trim and some dont I have a total of about 40 names only about 6 dont need the space after the coma.
I was thinking of Replace and If But I cant seem to put it together.

Claus Busch

unread,
May 22, 2013, 2:10:50 PM5/22/13
to
Hi,
I don't understand your example. In which case the space will be
removed? Why does the space in the second line remain?


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

jc99...@yahoo.com

unread,
May 22, 2013, 2:51:57 PM5/22/13
to
On Wednesday, May 22, 2013 12:57:40 PM UTC-5, jc99...@yahoo.com wrote:
> Hello I need help I have names on my left and depending on the name I need to remove a space Original data Answer John, Repp John,Repp Jay, Thorp Jay, Thorp Jana, Washington Jana,Washington So just depending on the name some need the space after the "," trim and some dont I have a total of about 40 names only about 6 dont need the space after the coma. I was thinking of Replace and If But I cant seem to put it together.



There are certain names that have to remain the same as the original data
but another 36 or so I have to trim the space after the comma
So I would have to hard code those 36 names in the formula if you can just hard code 2 for me I can do the rest.

Claus Busch

unread,
May 22, 2013, 2:58:39 PM5/22/13
to
Hi,

Am Wed, 22 May 2013 11:51:57 -0700 (PDT) schrieb jc99...@yahoo.com:

> There are certain names that have to remain the same as the original data
> but another 36 or so I have to trim the space after the comma
> So I would have to hard code those 36 names in the formula if you can just hard code 2 for me I can do the rest.

your names in column A. I wrote the names that will remain the space in
column H. Then in B1:
=IF(COUNTIF($H$1:$H$36,A1)=0,SUBSTITUTE(A1,", ",","),A1)

Claus Busch

unread,
May 22, 2013, 3:07:17 PM5/22/13
to
Hi again,

Am Wed, 22 May 2013 20:58:39 +0200 schrieb Claus Busch:

> =IF(COUNTIF($H$1:$H$36,A1)=0,SUBSTITUTE(A1,", ",","),A1)

if there are only 6 names to remove the space it is easier to write this
6 names in column H and then:
=IF(COUNTIF($H$1:$H$6,A1)>0,SUBSTITUTE(A1,", ",","),A1)

jc99...@yahoo.com

unread,
May 22, 2013, 3:41:00 PM5/22/13
to
On Wednesday, May 22, 2013 12:57:40 PM UTC-5, jc99...@yahoo.com wrote:
> Hello I need help I have names on my left and depending on the name I need to remove a space Original data Answer John, Repp John,Repp Jay, Thorp Jay, Thorp Jana, Washington Jana,Washington So just depending on the name some need the space after the "," trim and some dont I have a total of about 40 names only about 6 dont need the space after the coma. I was thinking of Replace and If But I cant seem to put it together.



Thank you Clause this works great
0 new messages