I have the following line of code that writes an excel formula. The formula needs to in a single cell but when I include the “,” comma within the quote as displayed below, everything to the right of the " ," is moved to the adjacent cell. How can I format to keep the “,” and the balance of the equation in a single cell? This line should produce two cells, one with “If loss avg daily loss %” and =averageif(m2:m10000,"<0.00%");
VarSetText("PARAM17","If loss avg daily loss %,=AVERAGEIF(m2:m10000," + "\"<0.00%\")");
It is Excel question, not AFL question.
Use Google, plenty of answers. The simplest is using quotation marks.
No, it is an AmiBroker question. The Excel formula works correctly in Excel. It is writing the Excel formula in AFL language that presents the issue so it is an AmiBroker question. I have tried quotation marks and it generates AmiBroker error messages. Can you shpw me where the quotation marks would go? I see nothing in the AmiBroker docs re escaping a “,”.
“writes an excel formula […] " ,” is moved to the adjacent cell."
It is EXCEL question. Arguing with the author is not good idea and considered rude.
You don’t need to escape commas in AmiBroker.
It is your Excel that creates problem as it interprets comma as a column separator, so you need to use quotations marks so Excel knows it is single field.
The original response applies.
If you tried quotation marks, but it gives you error, this is because you need to escape QUOTATION MARKS !
string1 = "\"String inside double quotes\"";
string2 = "\"No, you, don't need, to, escape, commas in Ami\"";
string3 = "\"Thanking,for,answer,is,better,than,arguing,in,response\"";
For what it is worth, the call from @reds example should look like this:
"\"If loss avg daily loss %\",\"=AVERAGEIF((M2:M10000),\"<0.00%\")\"");
It contains properly escaped double quotation marks needed by Excel to know where the cells begin and end.