Removing Commas in between quotation mark and numbers Excel Macro

Lekha mohanty

New Member
Joined
Oct 26, 2021
Messages
12
Office Version
  1. 2010
Platform
  1. Windows
  2. Web
In my excel sheet, I have data like

"","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595",""

I want to delete the comma within the number, for example in the above example the value 2878 is mentioned as 2,878, here I want to delete the comma between 2878, and the other commas in the should be there. Only the comma’s within the quotation marks should be deleted.

Result should be like this.
"","2878","-51","58","202.89","3935.80","40.65","50","3910.95","3927.95","50","14250.00","5050","0.40","0.45","7400","0.10","0.40","106.60","2665","-28","8595",""




Extract_261021_112409.csv
A
1"CALLS","","PUTS" " ","OI ","Chng in OI ","Volume ","IV ","LTP ","Chng ","Bid Qty ","Bid Price ","Ask Price ","Ask Qty ","Strike Price ","Bid Qty ","Bid Price ","Ask Price ","Ask Qty ","Chng ","LTP ","IV ","Volume ","Chng in OI ","OI "," " "","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595","" "","173","-2","2","239.75","3,950.00","90.00","400","3,798.35","3,888.50","50","14,300.00","1,100","0.40","0.45","1,000","-","0.40","105.16","242","-62","855","" "","-","-","-","-","-","-","850","3,706.50","3,917.65","750","14,350.00","50","0.60","0.65","1,800","-0.05","0.70","108.93","39","17","73","" "","2","-","-","-","-","-","350","3,662.75","3,864.95","1,800","14,400.00","250","0.45","0.55","1,500","-0.05","0.45","103.33","59","-","209","" "","-","-","-","-","-","-","1,000","3,599.25","3,820.05","550","14,450.00","1,500","0.05","1.70","1,500","-","-","-","-","-","-","" "","4,425","-98","136","155.59","3,673.20","22.40","100","3,668.50","3,681.40","150","14,500.00","9,000","0.45","0.50","2,400","0.10","0.45","101.38","984","-200","10,897","" "","-","-","-","-","-","-","400","3,504.70","3,720.95","550","14,550.00","1,500","0.05","2.05","1,500","-","-","-","-","-","-","" "","47","-","-","-","-","-","700","3,451.70","3,665.80","500","14,600.00","450","0.55","0.60","1,500","-0.10","0.60","101.52","72","38","301","" "","-","-","-","-","-","-","600","3,406.30","3,621.30","1,800","14,650.00","1,500","0.15","2.10","1,500","-","-","-","-","-","-","" "","9","-","-","-","-","-","550","3,296.85","3,565.70","500","14,700.00","1,500","0.35","0.50","1,650","-","0.45","94.77","1","-","331","" "","-","-","-","-","-","-","700","3,309.30","3,515.70","750","14,750.00","1,500","0.05","2.10","1,800","-","-","-","-","-","-","" "","138","-1","1","236.32","3,504.25","164.25","1,000","3,282.55","3,457.00","50","14,800.00","150","0.55","0.75","200","-0.10","0.55","93.58","33","-21","18","" "","-","-","-","-","-","-","550","3,185.10","3,505.70","1,650","14,850.00","-","-","2.25","1,800","-","-","-","-","-","-","" "","3","-","-","-","-","-","50","3,206.55","3,323.65","550","14,900.00","100","0.55","0.70","200","0.40","0.85","94.46","113","19","151","" "","4","-","-","-","-","-","50","3,114.90","3,312.65","150","14,950.00","150","0.20","1.65","1,500","-","-","-","-","-","8","" "","7,792","-63","68","147.37","3,174.10","31.75","900","3,159.55","3,179.25","100","15,000.00","20,700","0.45","0.50","11,200","-","0.45","86.32","1,105","-39","14,890","" "","-","-","-","-","-","-","600","2,998.35","3,209.70","800","15,050.00","900","0.05","1.85","1,500","-","-","-","-","-","1","" "","21","-","-","-","-","-","950","2,976.90","3,132.80","1,200","15,100.00","500","0.40","0.75","200","-0.35","0.40","82.68","5","-1","38","" "","-","-","-","-","-","-","700","2,863.90","3,107.90","800","15,150.00","1,500","0.05","2.15","1,500","-","-","-","-","-","-","" "","104","-","-","-","-","-","500","2,870.05","3,052.30","500","15,200.00","1,500","0.35","0.65","250","0.10","0.65","83.51","5","-1","131","" "","-","-","-","-","-","-","600","2,767.75","3,005.40","550","15,250.00","1,500","0.05","1.80","1,500","-","-","-","-","-","-","" "","225","-","-","-","-","-","500","2,809.60","2,903.90","650","15,300.00","50","0.50","0.55","550","-0.10","0.50","79.42","4,551","7","706","" "","-","-","-","-","-","-","550","2,729.90","2,865.75","50","15,350.00","300","0.45","1.85","1,500","-","0.90","81.77","1","-","15","" "","128","-","-","-","-","-","1,050","2,679.00","2,840.25","1,150","15,400.00","200","0.50","0.55","1,750","0.10","0.55","75.25","138","1","545","" "","-","-","-","-","-","-","550","2,622.45","2,794.90","1,650","15,450.00","50","0.55","2.15","50","-","0.70","73.88","8","-5","17","" "","1,822","-","109","129.19","2,683.15","36.35","50","2,679.95","2,684.55","250","15,500.00","1,800","0.65","0.70","1,000","-0.10","0.70","76.04","1,958","-18","15,160","" "","-","-","-","-","-","-","850","2,530.45","2,693.50","900","15,550.00","200","0.55","0.90","50","-","-","-","-","-","29","" "","31","-","-","-","-","-","500","2,483.50","2,640.95","500","15,600.00","350","0.80","0.95","450","0.15","0.80","72.20","112","2","861","" "","-","-","-","-","-","-","550","2,388.65","2,598.65","550","15,650.00","600","0.30","1.75","300","-","-","-","-","-","3","" "","113","-10","17","141.75","2,500.00","60.00","50","2,464.70","2,491.60","50","15,700.00","100","0.70","0.85","50","-0.05","0.80","68.87","107","20","1,335","" "","-","-","-","-","-","-","1,800","2,390.40","2,439.10","1,800","15,750.00","600","0.40","0.75","1,000","-","-","-","-","-","61","" "","339","-","1","155.00","2,440.00","88.75","300","2,367.80","2,387.50","750","15,800.00","450","0.85","0.95","1,000","-0.05","0.90","69.17","149","-9","2,512","" "","1","-","-","-","-","-","1,800","2,299.75","2,339.35","1,800","15,850.00","600","0.40","1.60","200","-","-","-","-","-","4","" "","134","-","1","148.49","2,336.85","109.25","50","2,244.15","2,288.15","1,800","15,900.00","350","0.85","0.95","650","-0.05","0.95","65.93","137","20","673","" "","2","-","-","-","-","-","1,800","2,201.70","2,247.00","1,800","15,950.00","50","0.65","0.85","50","-","-","-","-","-","42","" "","4,987","-4","215","109.94","2,179.50","23.85","400","2,174.55","2,184.40","1,200","16,000.00","7,750","0.75","0.80","5,150","-0.10","0.80","62.32","3,158","277","28,167","" "","7","-","-","-","-","-","50","2,105.30","2,145.70","50","16,050.00","600","0.65","0.80","450","-0.35","0.80","61.65","24","-1","73","" "","222","-4","30","95.92","2,080.00","34.15","200","2,067.40","2,086.25","50","16,100.00","500","0.85","0.90","250","-0.20","0.85","61.22","1,332","90","1,083","" "","15","-","-","-","-","-","50","2,003.60","2,039.45","50","16,150.00","100","1.00","1.20","50","0.05","1.25","60.92","330","6","36","" "","378","-","30","117.78","2,000.50","54.05","100","1,964.40","1,983.30","200","16,200.00","1,200","0.95","1.05","900","-0.15","0.95","58.92","998","93","1,892","" "","2","-","-","-","-","-","50","1,900.75","1,937.35","50","16,250.00","300","0.75","1.15","200","0.05","1.10","57.19","32","1","186","" "","421","-1","60","123.00","1,924.75","72.80","50","1,867.85","1,883.35","400","16,300.00","500","0.95","1.05","800","-","1.00","55.75","1,196","72","6,340","" "","7","-","-","-","-","-","50","1,801.45","1,835.30","50","16,350.00","400","0.75","1.45","100","-","1.05","54.04","3","-2","121","" "","379","-3","4","107.85","1,800.00","52.25","100","1,756.40","1,786.80","50","16,400.00","1,350","1.05","1.10","400","0.15","1.15","52.61","1,066","73","2,135","" "","6","-","-","-","-","-","1,800","1,710.40","1,743.00","50","16,450.00","600","0.85","1.35","50","0.25","1.05","51.17","35","-","166","" "","8,410","-12","131","79.64","1,675.00","28.90","50","1,674.65","1,682.40","50","16,500.00","9,650","1.15","1.20","30,850","-0.05","1.15","50.95","16,562","-366","42,448","" "","19","-","5","76.01","1,603.10","-6.90","50","1,603.30","1,634.50","1,800","16,550.00","1,150","1.00","1.45","100","-0.25","0.85","47.22","4","2","298","" "","607","-","2","124.29","1,568.25","10.95","50","1,568.35","1,584.75","50","16,600.00","1,500","1.20","1.25","650","0.10","1.25","48.24","3,711","386","5,266","" "","454","-","-","-","-","-","50","1,505.05","1,535.45","50","16,650.00","200","1.15","1.55","50","0.55","1.65","47.91","77","-14","1,158","" "","1,358","-","32","72.45","1,457.00","0.10","50","1,472.75","1,485.40","450","16,700.00","4,550","1.30","1.35","5,000","0.05","1.30","45.51","4,816","420","8,757","" "","78","-","-","-","-","-","1,800","1,413.90","1,442.25","50","16,750.00","100","1.10","1.30","50","0.35","1.40","44.05","116","-8","316","" "","697","-","-","-","-","-","50","1,366.40","1,384.65","50","16,800.00","5,150","1.30","1.35","1,450","0.10","1.35","42.58","9,475","378","20,209","" "","53","-","5","96.21","1,379.65","138.65","50","1,291.80","1,347.15","50","16,850.00","800","1.45","1.55","1,200","0.60","1.95","41.78","720","312","697","" "","1,116","-1","14","93.02","1,328.00","70.00","50","1,271.70","1,283.95","50","16,900.00","8,600","1.40","1.45","3,750","-","1.45","39.97","11,865","-77","16,451","" "","44","1","2","82.17",
Extract_261021_112409


Please help me with the excel macro code.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try something this way:

Book2
A
1"CALLS","","PUTS" " ","OI ","Chng in OI ","Volume ","IV ","LTP ","Chng ","Bid Qty ","Bid Price ","Ask Price ","Ask Qty ","Strike Price ","Bid Qty ","Bid Price ","Ask Price ","Ask Qty ","Chng ","LTP ","IV ","Volume ","Chng in OI ","OI "," " "","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595","" "","173","-2","2","239.75","3,950.00","90.00","400","3,798.35","3,888.50","50","14,300.00","1,100","0.40","0.45","1,000","-","0.40","105.16","242","-62","855","" "","-","-","-","-","-","-","850","3,706.50","3,917.65","750","14,350.00","50","0.60","0.65","1,800","-0.05","0.70","108.93","39","17","73","" "","2","-","-","-","-","-","350","3,662.75","3,864.95","1,800","14,400.00","250","0.45","0.55","1,500","-0.05","0.45","103.33","59","-","209","" "","-","-","-","-","-","-","1,000","3,599.25","3,820.05","550","14,450.00","1,500","0.05","1.70","1,500","-","-","-","-","-","-","" "","4,425","-98","136","155.59","3,673.20","22.40","100","3,668.50","3,681.40","150","14,500.00","9,000","0.45","0.50","2,400","0.10","0.45","101.38","984","-200","10,897","" "","-","-","-","-","-","-","400","3,504.70","3,720.95","550","14,550.00","1,500","0.05","2.05","1,500","-","-","-","-","-","-","" "","47","-","-","-","-","-","700","3,451.70","3,665.80","500","14,600.00","450","0.55","0.60","1,500","-0.10","0.60","101.52","72","38","301","" "","-","-","-","-","-","-","600","3,406.30","3,621.30","1,800","14,650.00","1,500","0.15","2.10","1,500","-","-","-","-","-","-","" "","9","-","-","-","-","-","550","3,296.85","3,565.70","500","14,700.00","1,500","0.35","0.50","1,650","-","0.45","94.77","1","-","331","" "","-","-","-","-","-","-","700","3,309.30","3,515.70","750","14,750.00","1,500","0.05","2.10","1,800","-","-","-","-","-","-","" "","138","-1","1","236.32","3,504.25","164.25","1,000","3,282.55","3,457.00","50","14,800.00","150","0.55","0.75","200","-0.10","0.55","93.58","33","-21","18","" "","-","-","-","-","-","-","550","3,185.10","3,505.70","1,650","14,850.00","-","-","2.25","1,800","-","-","-","-","-","-","" "","3","-","-","-","-","-","50","3,206.55","3,323.65","550","14,900.00","100","0.55","0.70","200","0.40","0.85","94.46","113","19","151","" "","4","-","-","-","-","-","50","3,114.90","3,312.65","150","14,950.00","150","0.20","1.65","1,500","-","-","-","-","-","8","" "","7,792","-63","68","147.37","3,174.10","31.75","900","3,159.55","3,179.25","100","15,000.00","20,700","0.45","0.50","11,200","-","0.45","86.32","1,105","-39","14,890","" "","-","-","-","-","-","-","600","2,998.35","3,209.70","800","15,050.00","900","0.05","1.85","1,500","-","-","-","-","-","1","" "","21","-","-","-","-","-","950","2,976.90","3,132.80","1,200","15,100.00","500","0.40","0.75","200","-0.35","0.40","82.68","5","-1","38","" "","-","-","-","-","-","-","700","2,863.90","3,107.90","800","15,150.00","1,500","0.05","2.15","1,500","-","-","-","-","-","-","" "","104","-","-","-","-","-","500","2,870.05","3,052.30","500","15,200.00","1,500","0.35","0.65","250","0.10","0.65","83.51","5","-1","131","" "","-","-","-","-","-","-","600","2,767.75","3,005.40","550","15,250.00","1,500","0.05","1.80","1,500","-","-","-","-","-","-","" "","225","-","-","-","-","-","500","2,809.60","2,903.90","650","15,300.00","50","0.50","0.55","550","-0.10","0.50","79.42","4,551","7","706","" "","-","-","-","-","-","-","550","2,729.90","2,865.75","50","15,350.00","300","0.45","1.85","1,500","-","0.90","81.77","1","-","15","" "","128","-","-","-","-","-","1,050","2,679.00","2,840.25","1,150","15,400.00","200","0.50","0.55","1,750","0.10","0.55","75.25","138","1","545","" "","-","-","-","-","-","-","550","2,622.45","2,794.90","1,650","15,450.00","50","0.55","2.15","50","-","0.70","73.88","8","-5","17","" "","1,822","-","109","129.19","2,683.15","36.35","50","2,679.95","2,684.55","250","15,500.00","1,800","0.65","0.70","1,000","-0.10","0.70","76.04","1,958","-18","15,160","" "","-","-","-","-","-","-","850","2,530.45","2,693.50","900","15,550.00","200","0.55","0.90","50","-","-","-","-","-","29","" "","31","-","-","-","-","-","500","2,483.50","2,640.95","500","15,600.00","350","0.80","0.95","450","0.15","0.80","72.20","112","2","861","" "","-","-","-","-","-","-","550","2,388.65","2,598.65","550","15,650.00","600","0.30","1.75","300","-","-","-","-","-","3","" "","113","-10","17","141.75","2,500.00","60.00","50","2,464.70","2,491.60","50","15,700.00","100","0.70","0.85","50","-0.05","0.80","68.87","107","20","1,335","" "","-","-","-","-","-","-","1,800","2,390.40","2,439.10","1,800","15,750.00","600","0.40","0.75","1,000","-","-","-","-","-","61","" "","339","-","1","155.00","2,440.00","88.75","300","2,367.80","2,387.50","750","15,800.00","450","0.85","0.95","1,000","-0.05","0.90","69.17","149","-9","2,512","" "","1","-","-","-","-","-","1,800","2,299.75","2,339.35","1,800","15,850.00","600","0.40","1.60","200","-","-","-","-","-","4","" "","134","-","1","148.49","2,336.85","109.25","50","2,244.15","2,288.15","1,800","15,900.00","350","0.85","0.95","650","-0.05","0.95","65.93","137","20","673","" "","2","-","-","-","-","-","1,800","2,201.70","2,247.00","1,800","15,950.00","50","0.65","0.85","50","-","-","-","-","-","42","" "","4,987","-4","215","109.94","2,179.50","23.85","400","2,174.55","2,184.40","1,200","16,000.00","7,750","0.75","0.80","5,150","-0.10","0.80","62.32","3,158","277","28,167","" "","7","-","-","-","-","-","50","2,105.30","2,145.70","50","16,050.00","600","0.65","0.80","450","-0.35","0.80","61.65","24","-1","73","" "","222","-4","30","95.92","2,080.00","34.15","200","2,067.40","2,086.25","50","16,100.00","500","0.85","0.90","250","-0.20","0.85","61.22","1,332","90","1,083","" "","15","-","-","-","-","-","50","2,003.60","2,039.45","50","16,150.00","100","1.00","1.20","50","0.05","1.25","60.92","330","6","36","" "","378","-","30","117.78","2,000.50","54.05","100","1,964.40","1,983.30","200","16,200.00","1,200","0.95","1.05","900","-0.15","0.95","58.92","998","93","1,892","" "","2","-","-","-","-","-","50","1,900.75","1,937.35","50","16,250.00","300","0.75","1.15","200","0.05","1.10","57.19","32","1","186","" "","421","-1","60","123.00","1,924.75","72.80","50","1,867.85","1,883.35","400","16,300.00","500","0.95","1.05","800","-","1.00","55.75","1,196","72","6,340","" "","7","-","-","-","-","-","50","1,801.45","1,835.30","50","16,350.00","400","0.75","1.45","100","-","1.05","54.04","3","-2","121","" "","379","-3","4","107.85","1,800.00","52.25","100","1,756.40","1,786.80","50","16,400.00","1,350","1.05","1.10","400","0.15","1.15","52.61","1,066","73","2,135","" "","6","-","-","-","-","-","1,800","1,710.40","1,743.00","50","16,450.00","600","0.85","1.35","50","0.25","1.05","51.17","35","-","166","" "","8,410","-12","131","79.64","1,675.00","28.90","50","1,674.65","1,682.40","50","16,500.00","9,650","1.15","1.20","30,850","-0.05","1.15","50.95","16,562","-366","42,448","" "","19","-","5","76.01","1,603.10","-6.90","50","1,603.30","1,634.50","1,800","16,550.00","1,150","1.00","1.45","100","-0.25","0.85","47.22","4","2","298","" "","607","-","2","124.29","1,568.25","10.95","50","1,568.35","1,584.75","50","16,600.00","1,500","1.20","1.25","650","0.10","1.25","48.24","3,711","386","5,266","" "","454","-","-","-","-","-","50","1,505.05","1,535.45","50","16,650.00","200","1.15","1.55","50","0.55","1.65","47.91","77","-14","1,158","" "","1,358","-","32","72.45","1,457.00","0.10","50","1,472.75","1,485.40","450","16,700.00","4,550","1.30","1.35","5,000","0.05","1.30","45.51","4,816","420","8,757","" "","78","-","-","-","-","-","1,800","1,413.90","1,442.25","50","16,750.00","100","1.10","1.30","50","0.35","1.40","44.05","116","-8","316","" "","697","-","-","-","-","-","50","1,366.40","1,384.65","50","16,800.00","5,150","1.30","1.35","1,450","0.10","1.35","42.58","9,475","378","20,209","" "","53","-","5","96.21","1,379.65","138.65","50","1,291.80","1,347.15","50","16,850.00","800","1.45","1.55","1,200","0.60","1.95","41.78","720","312","697","" "","1,116","-1","14","93.02","1,328.00","70.00","50","1,271.70","1,283.95","50","16,900.00","8,600","1.40","1.45","3,750","-","1.45","39.97","11,865","-77","16,451","" "","44","1","2","82.17",
2"CALLS","","PUTS" " ","OI ","Chng in OI ","Volume ","IV ","LTP ","Chng ","Bid Qty ","Bid Price ","Ask Price ","Ask Qty ","Strike Price ","Bid Qty ","Bid Price ","Ask Price ","Ask Qty ","Chng ","LTP ","IV ","Volume ","Chng in OI ","OI "," " "","2878","-51","58","202.89","3935.80","40.65","50","3910.95","3927.95","50","14250.00","5050","0.40","0.45","7400","0.10","0.40","106.60","2665","-28","8595","" "","173","-2","2","239.75","3950.00","90.00","400","3798.35","3888.50","50","14300.00","1100","0.40","0.45","1000","-","0.40","105.16","242","-62","855","" "","-","-","-","-","-","-","850","3706.50","3917.65","750","14350.00","50","0.60","0.65","1800","-0.05","0.70","108.93","39","17","73","" "","2","-","-","-","-","-","350","3662.75","3864.95","1800","14400.00","250","0.45","0.55","1500","-0.05","0.45","103.33","59","-","209","" "","-","-","-","-","-","-","1000","3599.25","3820.05","550","14450.00","1500","0.05","1.70","1500","-","-","-","-","-","-","" "","4425","-98","136","155.59","3673.20","22.40","100","3668.50","3681.40","150","14500.00","9000","0.45","0.50","2400","0.10","0.45","101.38","984","-200","10897","" "","-","-","-","-","-","-","400","3504.70","3720.95","550","14550.00","1500","0.05","2.05","1500","-","-","-","-","-","-","" "","47","-","-","-","-","-","700","3451.70","3665.80","500","14600.00","450","0.55","0.60","1500","-0.10","0.60","101.52","72","38","301","" "","-","-","-","-","-","-","600","3406.30","3621.30","1800","14650.00","1500","0.15","2.10","1500","-","-","-","-","-","-","" "","9","-","-","-","-","-","550","3296.85","3565.70","500","14700.00","1500","0.35","0.50","1650","-","0.45","94.77","1","-","331","" "","-","-","-","-","-","-","700","3309.30","3515.70","750","14750.00","1500","0.05","2.10","1800","-","-","-","-","-","-","" "","138","-1","1","236.32","3504.25","164.25","1000","3282.55","3457.00","50","14800.00","150","0.55","0.75","200","-0.10","0.55","93.58","33","-21","18","" "","-","-","-","-","-","-","550","3185.10","3505.70","1650","14850.00","-","-","2.25","1800","-","-","-","-","-","-","" "","3","-","-","-","-","-","50","3206.55","3323.65","550","14900.00","100","0.55","0.70","200","0.40","0.85","94.46","113","19","151","" "","4","-","-","-","-","-","50","3114.90","3312.65","150","14950.00","150","0.20","1.65","1500","-","-","-","-","-","8","" "","7792","-63","68","147.37","3174.10","31.75","900","3159.55","3179.25","100","15000.00","20700","0.45","0.50","11200","-","0.45","86.32","1105","-39","14890","" "","-","-","-","-","-","-","600","2998.35","3209.70","800","15050.00","900","0.05","1.85","1500","-","-","-","-","-","1","" "","21","-","-","-","-","-","950","2976.90","3132.80","1200","15100.00","500","0.40","0.75","200","-0.35","0.40","82.68","5","-1","38","" "","-","-","-","-","-","-","700","2863.90","3107.90","800","15150.00","1500","0.05","2.15","1500","-","-","-","-","-","-","" "","104","-","-","-","-","-","500","2870.05","3052.30","500","15200.00","1500","0.35","0.65","250","0.10","0.65","83.51","5","-1","131","" "","-","-","-","-","-","-","600","2767.75","3005.40","550","15250.00","1500","0.05","1.80","1500","-","-","-","-","-","-","" "","225","-","-","-","-","-","500","2809.60","2903.90","650","15300.00","50","0.50","0.55","550","-0.10","0.50","79.42","4551","7","706","" "","-","-","-","-","-","-","550","2729.90","2865.75","50","15350.00","300","0.45","1.85","1500","-","0.90","81.77","1","-","15","" "","128","-","-","-","-","-","1050","2679.00","2840.25","1150","15400.00","200","0.50","0.55","1750","0.10","0.55","75.25","138","1","545","" "","-","-","-","-","-","-","550","2622.45","2794.90","1650","15450.00","50","0.55","2.15","50","-","0.70","73.88","8","-5","17","" "","1822","-","109","129.19","2683.15","36.35","50","2679.95","2684.55","250","15500.00","1800","0.65","0.70","1000","-0.10","0.70","76.04","1958","-18","15160","" "","-","-","-","-","-","-","850","2530.45","2693.50","900","15550.00","200","0.55","0.90","50","-","-","-","-","-","29","" "","31","-","-","-","-","-","500","2483.50","2640.95","500","15600.00","350","0.80","0.95","450","0.15","0.80","72.20","112","2","861","" "","-","-","-","-","-","-","550","2388.65","2598.65","550","15650.00","600","0.30","1.75","300","-","-","-","-","-","3","" "","113","-10","17","141.75","2500.00","60.00","50","2464.70","2491.60","50","15700.00","100","0.70","0.85","50","-0.05","0.80","68.87","107","20","1335","" "","-","-","-","-","-","-","1800","2390.40","2439.10","1800","15750.00","600","0.40","0.75","1000","-","-","-","-","-","61","" "","339","-","1","155.00","2440.00","88.75","300","2367.80","2387.50","750","15800.00","450","0.85","0.95","1000","-0.05","0.90","69.17","149","-9","2512","" "","1","-","-","-","-","-","1800","2299.75","2339.35","1800","15850.00","600","0.40","1.60","200","-","-","-","-","-","4","" "","134","-","1","148.49","2336.85","109.25","50","2244.15","2288.15","1800","15900.00","350","0.85","0.95","650","-0.05","0.95","65.93","137","20","673","" "","2","-","-","-","-","-","1800","2201.70","2247.00","1800","15950.00","50","0.65","0.85","50","-","-","-","-","-","42","" "","4987","-4","215","109.94","2179.50","23.85","400","2174.55","2184.40","1200","16000.00","7750","0.75","0.80","5150","-0.10","0.80","62.32","3158","277","28167","" "","7","-","-","-","-","-","50","2105.30","2145.70","50","16050.00","600","0.65","0.80","450","-0.35","0.80","61.65","24","-1","73","" "","222","-4","30","95.92","2080.00","34.15","200","2067.40","2086.25","50","16100.00","500","0.85","0.90","250","-0.20","0.85","61.22","1332","90","1083","" "","15","-","-","-","-","-","50","2003.60","2039.45","50","16150.00","100","1.00","1.20","50","0.05","1.25","60.92","330","6","36","" "","378","-","30","117.78","2000.50","54.05","100","1964.40","1983.30","200","16200.00","1200","0.95","1.05","900","-0.15","0.95","58.92","998","93","1892","" "","2","-","-","-","-","-","50","1900.75","1937.35","50","16250.00","300","0.75","1.15","200","0.05","1.10","57.19","32","1","186","" "","421","-1","60","123.00","1924.75","72.80","50","1867.85","1883.35","400","16300.00","500","0.95","1.05","800","-","1.00","55.75","1196","72","6340","" "","7","-","-","-","-","-","50","1801.45","1835.30","50","16350.00","400","0.75","1.45","100","-","1.05","54.04","3","-2","121","" "","379","-3","4","107.85","1800.00","52.25","100","1756.40","1786.80","50","16400.00","1350","1.05","1.10","400","0.15","1.15","52.61","1066","73","2135","" "","6","-","-","-","-","-","1800","1710.40","1743.00","50","16450.00","600","0.85","1.35","50","0.25","1.05","51.17","35","-","166","" "","8410","-12","131","79.64","1675.00","28.90","50","1674.65","1682.40","50","16500.00","9650","1.15","1.20","30850","-0.05","1.15","50.95","16562","-366","42448","" "","19","-","5","76.01","1603.10","-6.90","50","1603.30","1634.50","1800","16550.00","1150","1.00","1.45","100","-0.25","0.85","47.22","4","2","298","" "","607","-","2","124.29","1568.25","10.95","50","1568.35","1584.75","50","16600.00","1500","1.20","1.25","650","0.10","1.25","48.24","3711","386","5266","" "","454","-","-","-","-","-","50","1505.05","1535.45","50","16650.00","200","1.15","1.55","50","0.55","1.65","47.91","77","-14","1158","" "","1358","-","32","72.45","1457.00","0.10","50","1472.75","1485.40","450","16700.00","4550","1.30","1.35","5000","0.05","1.30","45.51","4816","420","8757","" "","78","-","-","-","-","-","1800","1413.90","1442.25","50","16750.00","100","1.10","1.30","50","0.35","1.40","44.05","116","-8","316","" "","697","-","-","-","-","-","50","1366.40","1384.65","50","16800.00","5150","1.30","1.35","1450","0.10","1.35","42.58","9475","378","20209","" "","53","-","5","96.21","1379.65","138.65","50","1291.80","1347.15","50","16850.00","800","1.45","1.55","1200","0.60","1.95","41.78","720","312","697","" "","1116","-1","14","93.02","1328.00","70.00","50","1271.70","1283.95","50","16900.00","8600","1.40","1.45","3750","-","1.45","39.97","11865","-77","16451","" "","44","1","2","82.17"
Sheet1
Cell Formulas
RangeFormula
A2A2=RemoveCommas(A1)


And this UDF is:

VBA Code:
Function RemoveCommas(inputStr As String) As String
a = Replace(inputStr, Chr(34) & "," & Chr(34), "^")
a = Split(a, "^")
For i = LBound(a) To UBound(a)
   a(i) = Replace(a(i), ",", "")
Next i
RemoveCommas = Join(a, Chr(34) & "," & Chr(34))
End Function
 
Upvote 0
Solution
After eliminating the comma, I want to replace all the quotation marks into blank, or simply delete all the quotation ( " ) marks from the sheet. can you please help me with that ?
 
Upvote 0
Try this:

VBA Code:
Function RemoveCommasAndQuotes(inputStr As String) As String
a = Replace(inputStr, Chr(34) & "," & Chr(34), "^")
a = Replace(a, """", "")
a = Split(a, "^")
For i = LBound(a) To UBound(a)
   a(i) = Replace(a(i), ",", "")
Next i
RemoveCommasAndQuotes = Join(a, ",")
End Function
 
Upvote 0
Or without any looping

VBA Code:
Function CleanUp(s As String) As String
  With CreateObject("VBScript.RegExp")
    .Global = True
    .Pattern = "("")|(,(?=\d))"
    CleanUp = .Replace(s, "")
  End With
End Function

Lekha mohanty.xlsm
AB
1"","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595","",2878,-51,58,202.89,3935.80,40.65,50,3910.95,3927.95,50,14250.00,5050,0.40,0.45,7400,0.10,0.40,106.60,2665,-28,8595,
Sheet1
Cell Formulas
RangeFormula
B1B1=CleanUp(A1)
 
Upvote 0
.. or I guess more simply

VBA Code:
Function CleanIt(s As String) As String
  CleanIt = Replace(Replace(Replace(Replace(s, """,""", "#"), ",", ""), "#", ","), """", "")
End Function

Lekha mohanty.xlsm
AB
1"","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595","",2878,-51,58,202.89,3935.80,40.65,50,3910.95,3927.95,50,14250.00,5050,0.40,0.45,7400,0.10,0.40,106.60,2665,-28,8595,
Sheet1
Cell Formulas
RangeFormula
B1B1=CleanIt(A1)
 
Upvote 0
.. or do you really need vba when a reasonably short standard worksheet formula will do the same job?

Lekha mohanty.xlsm
AB
1"","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595","",2878,-51,58,202.89,3935.80,40.65,50,3910.95,3927.95,50,14250.00,5050,0.40,0.45,7400,0.10,0.40,106.60,2665,-28,8595,
Sheet1
Cell Formulas
RangeFormula
B1B1=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,""",""","#"),",",""),"#",","),"""","")
 
Upvote 0
Thank you Kokosek and Peter for help till now, I was doing the task in a csv file hence removing comma is working, but when I removed the quotation using your formula that is also working but the result is not coming out as per my expectation. There are total 21 columns and data in columns. After removing the comma and opening the file in MS word and after removing the quotations there and again saving the file as CSV then again if I will open the file them I am getting the desired result in 21 columns.

Now I will do this in excel after removing the comma, I want a macro code to separate the data into 21 columns.

"","2878","-51","58","202.89","3935.80","40.65","50","3910.95","3927.95","50","14250.00","5050","0.40","0.45","7400","0.10","0.40","106.60","2665","-28","8595",""

After removing the comma the data looks like this. there is additional "", at the starting and ,"" after each row ending and in between quotation and comma the cell value is there. I want in to extract into different cells in Sheet 2. Please help me with the code.

I want the output to look like this.

Book1
ABCDEFGHIJKLMNOPQRSTUV
1CALLSPUTS
2 OI Chng in OI Volume IV LTP Chng Bid Qty Bid Price Ask Price Ask Qty Strike Price Bid Qty Bid Price Ask Price Ask Qty Chng LTP IV Volume Chng in OI OI
32878-5158202.893935.840.65503910.953927.95501425050500.40.4574000.10.4106.62665-288595
4173-22239.753950904003798.353888.5501430011000.40.451000-0.4105.16242-62855
5------8503706.53917.6575014350500.60.651800-0.050.7108.93391773
62-----3503662.753864.951800144002500.450.551500-0.050.45103.3359-209
7------10003599.253820.055501445015000.051.71500------
84425-98136155.593673.222.41003668.53681.41501450090000.450.524000.10.45101.38984-20010897
9------4003504.73720.955501455015000.052.051500------
1047-----7003451.73665.8500146004500.550.61500-0.10.6101.527238301
11------6003406.33621.318001465015000.152.11500------
129-----5503296.853565.75001470015000.350.51650-0.4594.771-331
13------7003309.33515.77501475015000.052.11800------
14138-11236.323504.25164.2510003282.55345750148001500.550.75200-0.10.5593.5833-2118
15------5503185.13505.7165014850--2.251800------
163-----503206.553323.65550149001000.550.72000.40.8594.4611319151
174-----503114.93312.65150149501500.21.651500-----8
187792-6368147.373174.131.759003159.553179.2510015000207000.450.511200-0.4586.321105-3914890
19------6002998.353209.7800150509000.051.851500-----1
2021-----9502976.93132.81200151005000.40.75200-0.350.482.685-138
21------7002863.93107.98001515015000.052.151500------
22104-----5002870.053052.35001520015000.350.652500.10.6583.515-1131
23------6002767.753005.45501525015000.051.81500------
24225-----5002809.62903.965015300500.50.55550-0.10.579.4245517706
25------5502729.92865.7550153503000.451.851500-0.981.771-15
26128-----105026792840.251150154002000.50.5517500.10.5575.251381545
27------5502622.452794.9165015450500.552.1550-0.773.888-517
281822-109129.192683.1536.35502679.952684.552501550018000.650.71000-0.10.776.041958-1815160
29------8502530.452693.5900155502000.550.950-----29
3031-----5002483.52640.95500156003500.80.954500.150.872.21122861
31------5502388.652598.65550156506000.31.75300-----3
32113-1017141.75250060502464.72491.650157001000.70.8550-0.050.868.87107201335
33------18002390.42439.11800157506000.40.751000-----61
34339-1155244088.753002367.82387.5750158004500.850.951000-0.050.969.17149-92512
351-----18002299.752339.351800158506000.41.6200-----4
36134-1148.492336.85109.25502244.152288.151800159003500.850.95650-0.050.9565.9313720673
372-----18002201.72247180015950500.650.8550-----42
384987-4215109.942179.523.854002174.552184.412001600077500.750.85150-0.10.862.32315827728167
397-----502105.32145.750160506000.650.8450-0.350.861.6524-173
40222-43095.92208034.152002067.42086.2550161005000.850.9250-0.20.8561.221332901083
4115-----502003.62039.45501615010011.2500.051.2560.92330636
42378-30117.782000.554.051001964.41983.32001620012000.951.05900-0.150.9558.92998931892
432-----501900.751937.3550162503000.751.152000.051.157.19321186
44421-1601231924.7572.8501867.851883.35400163005000.951.05800-155.751196726340
457-----501801.451835.350163504000.751.45100-1.0554.043-2121
46379-34107.85180052.251001756.41786.8501640013501.051.14000.151.1552.611066732135
476-----18001710.4174350164506000.851.35500.251.0551.1735-166
488410-1213179.64167528.9501674.651682.4501650096501.151.230850-0.051.1550.9516562-36642448
4919-576.011603.1-6.9501603.31634.5180016550115011.45100-0.250.8547.2242298
50607-2124.291568.2510.95501568.351584.75501660015001.21.256500.11.2548.2437113865266
51454-----501505.051535.4550166502001.151.55500.551.6547.9177-141158
521358-3272.4514570.1501472.751485.44501670045501.31.3550000.051.345.5148164208757
5378-----18001413.91442.2550167501001.11.3500.351.444.05116-8316
54697-----501366.41384.65501680051501.31.3514500.11.3542.58947537820209
5553-596.211379.65138.65501291.81347.1550168508001.451.5512000.61.9541.78720312697
561116-11493.02132870501271.71283.95501690086001.41.453750-1.4539.9711865-7716451
57441282.171222.4561.25011921254.95501695010001.351.552000.21.538.8636-381842
5810402-10318766.321181.835.851001176.151181.65155017000138501.751.8328500.11.7538.1468405-593170116
5950-----501115.21132.15450170502001.851.9514000.251.9537.23561-1211291
601152-981.141124.1661001074.41082.15017100670022.0533000.052.0536.1320202-159618362
6163-----10001021.751031.1510001715011502.12.2500.32.334.971361-661877
622324-3112652.71977.634.45150975.15981.58001720027002.32.352400-2.333.7533270425633586
6392-4651.02911.120.551250916.6935.15501725012002.552.651050-0.12.5532.825358-7215053
642434-92763.06883.432.9300873.95883501730014002.92.95650-0.12.931.760599-110534556
6596-369.55842.6577.11000817.95831.8510001735011503.33.450-0.23.3531.547983-3247901
662404-226748.4277622.75100775.9782.653001740032003.9542650-0.43.9529.871184852363162892
671961561.77773.370.350717.25736.15017450504.354.4250-0.754.3528.44154144257287
6812585-375185041.2268027.6550679.8681.51001750010005.155.21050-1.355.1527.55124127129280096
69243-554.73627.259.651000621.45634.9200175501005.855.950-1.655.8526.2928031259312647
705460-18055335.57576.417.650581.7583.3550176003507.057.1350-2.45725.45108763-111745630
71741-4459.73532.8525.65100531.95534.85017650508.68.65150-38.6524.6337773429581
729725-1168285432.38482.3517.4550485.25486.851501770070010.6510.751100-4.510.6523.8124245802842212
73624-1622835.81445.726.6550438.5440.05501775010013.613.65400-5.6513.6523.12590931113419590
7416042-10418329.839422.1100391.9393.252001780095017.8517.951900-6.7517.922.48182141350466122
7510274337729.29341.3512.8550348349.3501785020023.123.21550-7.8523.352278397342412249
7611581-322980527.79305.8519.150305.45306.65200179001503030.1600-9.530.0521.43237254-194148440
771011-334300226.79262.914.5450263.45264.3501795055039.239.35400-11.239.321.15112739220913349
7829654-81578293625.8222615.05100225.5226501800070049.95050-14.0549.820.584649761331791149
794126-12082273725.1918911.8550188.618950180505063.863.9550-16.2563.819.99142576729115770
8044695-32420124624.34157.111.5100156.65157.05501810025080.580.65150-17.858119.774600011310059174
8132012423217662923.651278.9350126.6126.855018150600100.65100.9350-20.310119.22217895899323811
82124626152670795222.99100.16.1850100100.154501820050124.25124.45100-23.35124.2518.575487982600081699
83481991600835462222.6877.853.95120077.8578.0525018250250152.05152.550-26.55151.8517.41179741639211428
841367622351071982322.2158.952.1575058.9559.135018300100183.65184350-27.0518417.02182238740734237
8538313363823272922.1244.050.465043.9544.0525018350100219.222050-27.4218.1515.06212214862723
86107969142344535621.9232.35-0.55032.3532.45018400300256.8257.450-30.45256.412.9636165142817506
8733323246317288121.8523.65-1.3575023.623.711001845050298.25299.550-26.9300.85-4112-381578
881439231184542321721.8817.05-1.759001717.1235018500400340.8341.95250-30.95340.95-19424-103930803
8931030466414125521.912.1-1.75525012.112.221501855050386.15387.650-31.45386.55-473-711072
9090452856322691822.148.9-1.6536508.98.952001860050434.6436.0550-29.95433.65-4004113617390
9142537102599402922.516.75-1.26006.76.75350018650350479.8482.95100-24.8482.1-9229345
92871231129818128923.275.55-1.0532005.555.6380018700100528.6530.0550-18.6537.8-601-141331
93215625255205824.24.7-0.655504.654.7145018750200573.35587.15250-70.25539.5-7-1197
9472321154513271825.54.3-0.5559504.254.35001880050626.8628.550-23.45632.2-369-151209
951046312612066826.743.95-0.3517003.853.95375018850600673.25686.7200-127.7580.15-11-183
9667699-317211443227.993.65-0.4564503.63.6597501890050725.3730.1800-38.25721.1-31-2276
9763663421044929.273.25-0.4525503.253.3475018950100773.85785.7520010.3793.4-431545
98128369-1335111695830.353.05-0.51340033.05290019000750824.65827.95450-21.25830.65-1630-9537740
994036-230229931.712.85-0.25502.852.9190019050250868.25884.25100-----17
10034117-109305909332.72.75-0.159502.752.8565019100250921.45934.5750-28.9930.2-344108
1011601-339230634.192.65-0.252002.652.755019150200973.1982.6200-----13
10233375-18993301835.292.55-0.2563002.52.55275019200501024.351035.3250-27.751024.25-1-197
103155327123236.452.5-0.25502.552.6512501925010001070.151081.150-----3
10431489-3772158537.812.45-0.177002.42.51035019300501121.31130.85200-64.151094.45-112-33538
1051348-3929638.812.3-0.2511502.32.45019350501164.051186.052050-1131115.9-1-57
10613014-2531447540.382.35-0.1559002.352.45050194004001204.651234.4550-94.551165.45-1-369
107329-3620741.582.350.05502.12.355019450501248.11294.1550-34.51248.1-2-3
10881559-9095254842.772.25-0.2583502.252.31495019500501322.451330.450-16.81334.5-14-12676
1096471934543.542.1-0.2511002.052.2520019550501347.91410.850-----3
1107503216532745.12.15-0.18002.12.15250196002001397.851437.250-----6
1115147135446.092-0.112001.952.1520019650501447.751510.950-----1
1125478-10431947.652.05-0.05205022.1700197002001497.71540.5200-----1
11364813438148.911.950.3512001.91.95300197505015601589.850-----1
1148036573799149.871.8-0.110501.851.951650198002001622.21633.750-19.21601.8-7362
11583055950.631.9-2001.751.854001985018001660.951691.9550-----9
11612726-276731852.191.90.15001.91.951700199001001711.451742.35200-----4
11728777036853.581.90.34001.9212001995018001761.41792.41800-----1
11863101-39572981754.121.750.0535001.751.8340020000501810.41833.8550-15.551830.7-10774
Sheet1
 
Upvote 0
Just paste text code in to cell A1, then using this in B1 and drag accross as far as needed.

TABEL EXAMPLE.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1"","2,878","-51","58","202.89","3,935.80","40.65","50","3,910.95","3,927.95","50","14,250.00","5,050","0.40","0.45","7,400","0.10","0.40","106.60","2,665","-28","8,595",""2,878.00- 51.0058.00202.893,935.8040.6550.003,910.953,927.9550.0014,250.005,050.000.400.457,400.000.100.40106.602,665.00- 28.008,595.00
Sheet4
Cell Formulas
RangeFormula
B1:Z1B1=IFERROR(TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,""",""","|"),",",""),"|",REPT(" ",1000),COLUMN(A:A)),"|",REPT(" ",1000),COLUMN(A:A)),1000,1000))+0,"")
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top