Long formula "Compile error: Syntax error"

Muralikrishnan

New Member
Joined
Mar 15, 2009
Messages
20
Hi There,
I am applying a formula in excel and it is working fine. I am recording the macro with the formula and I am getting Syntax error. The formula is "=IF(RIGHT(TRIM(LEFT(F2,IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(FIND(".",F2,1),FIND(" @",F2,1)),FIND(" 0",F2,1)),FIND(" 1",F2,1)),FIND(" 2",F2,1)),FIND(" 3",F2,1)),FIND(" 4",F2,1)),FIND(" 5",F2,1)),FIND(" 6",F2,1)),FIND(" 7",F2,1)),FIND(" 8",F2,1)),FIND(" 9",F2,1)))),1)=".",LEFT(TRIM(LEFT(F2,IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(FIND(".",F2,1),FIND(" @",F2,1)),FIND(" 0",F2,1)),FIND(" 1",F2,1)),FIND(" 2",F2,1)),FIND(" 3",F2,1)),FIND(" 4",F2,1)),FIND(" 5",F2,1)),FIND(" 6",F2,1)),FIND(" 7",F2,1)),FIND(" 8",F2,1)),FIND(" 9",F2,1)))),(LEN(TRIM(LEFT(F2,IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(FIND(".",F2,1),FIND(" @",F2,1)),FIND(" 0",F2,1)),FIND(" 1",F2,1)),FIND(" 2",F2,1)),FIND(" 3",F2,1)),FIND(" 4",F2,1)),FIND(" 5",F2,1)),FIND(" 6",F2,1)),FIND(" 7",F2,1)),FIND(" 8",F2,1)),FIND(" 9",F2,1)))))-1)),TRIM(LEFT(F2,IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(FIND(".",F2,1),FIND(" @",F2,1)),FIND(" 0",F2,1)),FIND(" 1",F2,1)),FIND(" 2",F2,1)),FIND(" 3",F2,1)),FIND(" 4",F2,1)),FIND(" 5",F2,1)),FIND(" 6",F2,1)),FIND(" 7",F2,1)),FIND(" 8",F2,1)),FIND(" 9",F2,1)))))"

Appreciate someone's help to fix the issue in VBA.
Thanks in advance,
Muralikrishnan V
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
All of the single quotes need to be replaced with double quotes when using it in VBA

eg...
Code:
FIND(".",F2,1

should be

Code:
FIND([color=red]"".""[/color],F2,1
 
Upvote 0
What are you actually trying to do with the formula...maybe if you posted a SMALL sample of before and after data someone could provide a more useful solution !!!
 
Upvote 0
Before you get to the vba implementation ..

1. If you are using Excel 2010 or later, does this formula used directly in the worksheet, give you the results you expect? If not, please give an example of the F2 text and the expected result for that text.

=LEFT(F2,AGGREGATE(15,6,(FIND(" "&{".","@",0,1,2,3,4,5,6,7,8,9},SUBSTITUTE(F2,"."," ."))),1)-1)


2. If you are using Excel 2007 or earlier, does this formula used directly in the worksheet, give you the results you expect? If not, please give an example of the F2 text and the expected result for that text.

=LEFT(F2,MIN(FIND(" "&{".","@",0,1,2,3,4,5,6,7,8,9},SUBSTITUTE(F2,"."," .")&" . @ 0 1 2 3 4 5 6 7 8 9"))-1)
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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