简体   繁体   中英

Remove comma in quoted string - no vba

I have this string in cell A1

"A","Agilent Technologies, Inc.",60.73

I'm trying to figure out a formula to get this result in cell B1

A,Agilent Technologies Inc.,60.73

Although I have a solution with VBA, I was wondering if there's a way do that without VBA.
So only using excel formulas.
Preferably a single cell formula.

The easy part is getting rid of the quotes (that's easy).
The hard part is getting rid of the comma in "Agilent Technologies, Inc." because that's the field delimiter.

ps: I can't just remove the 2nd comma, because the number of fields can differ.
For example, the name "Agilent Technologies, Inc." could be the 3rd of 4th field.

Another example would be

"C=F","Corn Futures,Dec-2017,Composite",394.25

Which needs to become

C=F,Corn Futures Dec-2017 Composite,394.25

Rule/Logic
The field delimiter is a comma.
Any comma that is found within a quoted string (between " and " ) should be removed.
The comma's that serve as field delimiter must remain.
Finally, the quotes ( " ) must be removed too.

If there is always a space before a comma in a quoted string, then

=SUBSTITUTE(SUBSTITUTE(A1;", ";" ");"""";"") 

will work.

您无需使用任何公式,只需使用“查找和替换”功能(Ctrl + H),然后将所有"替换为空白。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM