Excel export question and formula help needed

I have this data in an excel file. I use Office 2007 on a WinPro7 machine.

CLG2      12/14/2011,  5:01:55 PM      BUY      1      \a
CLF2      12/14/2011,  5:02:10 PM      SELL      1      \a

I need that to export as a text file where a comma separates each field or should I say a comma and a space?  Like this:

CLG2, 12/14/2011, 5:01:55 PM, BUY 1 \a
CLF2, 12/14/2011,  5:02:10 PM, SELL 1\a

Actualy, I just noticed there is no comma after the word BUY or SELL and there is no comma or space between the number 1 and the \a.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Glenn RayExcel VBA DeveloperCommented:
I noticed there there is no comma following the first substring (ex., "CLG2").  Will that always be the case in the source data, or is there the possibility of commas there?
wfcrrAuthor Commented:
Once it is exported to text file, I need it to be like this:

CLG2, 12/14/2011, 5:01:55 PM, BUY 1 \a
wfcrrAuthor Commented:
The first 3 things need a comma. The last thing "BUY" or "SELL" doesnt need a comma.

Sorry, one more correction. The "1\a" is not to have a space.  The following is actually the correct:

CLG2, 12/14/2011, 5:01:55 PM, BUY 1\a
For a one-off or occasional job you could do this:

Add a new worksheet
Put the following formula in cell A1:
=IF(ISBLANK(Sheet1!A1),"",Sheet1!A1&", "&Sheet1!B1&", "&TEXT(Sheet1!C1,"h:mm:ss")&" "&Sheet1!D1&", "&Sheet1!E1&" "&Sheet1!F1&Sheet1!G1)
Copy it down as far as required
Save as a text file

Edit the text file and replace all " marks with nothing (ie remove them).
(Excel insists on adding "" marks around every line).


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mke that:

=IF(ISBLANK(Sheet1!A1),"",Sheet1!A1&", "&Sheet1!B1&" "&TEXT(Sheet1!C1,"h:mm:ss")&" "&Sheet1!D1&", "&Sheet1!E1&" "&Sheet1!F1&Sheet1!G1)

since the date is followed by a comma already.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.