View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Peo Sjoblom
 
Posts: n/a
Default remove one character from a cell if a condition is met

If you precede the entry with an apostrophe ' or format as text it won't
convert the entries

you can use a help column to remove a trailing comma

=IF(RIGHT(A1)=",",LEFT(A1,LEN(A1)-1),A1)

and copy down the paste special as values

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"Jeff" wrote in message
...
I have a datafile used to make a website. The datafile is produced in excel
and then saved as a comma delimed file. One of the colums headers is
categoryids this is the category id for each product in the file, and
each
product resides in several different categories. For example the
categopryid
cell for product X might be:
123,456,789,1011,1012,1416 when I type this number into a cell in excel
excel converts this entry to the following: 123,456,789,101,110,000,000
as
you can see only the first three category references are correct the rest
are
incorrect. If I place a comma at the end like this
123,456,789,1011,1012,1416, then excel leaves it alone until I save the
file
and reopen it again at which point excel turns it back
to:123,456,789,101,110,000,000 . Thinking that the comma at the end would
solve my problem I added to all entries that excel had changed and
uploaded
the saved csv file to the server software and it was rejected because of
the
last comma. I was told I need to remove it before it can be accepted. I
was
told that I must now open the csv file in notepad and remove all the
trailing
commas then upload the file. My question is 2 fold. 1. Is there any way to
stop excel from converting this 123,456,789,1011,1012,1416 into
123,456,789,101,110,000,000 ? 2. I now have a category column for my
150000
products where some of the entries have a trailing "," and some do not.
How
do I get rid of the trailing comma without affecting the other commas in
the
sequence. The category reference sequence may have 3 or 4 or 5 or 6
different 3 or 4 number category references for the references where I
entered 123,456,789 excel left these alone and didint convert them so I
didnt
need to add a comma after these but about 4000 entries remain with the
comma
at the end. Thank you for your sharing your expertise.