2.101 FAQ-988 How do I add cell formula in column label row during data importing?

Last Update: 1/9/2019

It is a general idea to set column label rows by using cell formula for some after-process of data importing. However, Origin disables cell formula during import for the concern that your data may include text beginning with "=". If you really want to use cell formula during import, you can set @ESC to 1 to turn on cell formula before running any of the after-import scripts.

For example, if you want to import data by Import ASCII tool and set Comment to be the difference between the maximum and minimum of that column, you can put the following scripts in the Script after Each File Imported box in the impASC dialog

int nOld = @ESC; //keep record of original value of @ESC
@ESC = 1; //force cell formula enable
//start your code for after import process
for(int ii=1; ii<=wks.ncols; ii++)
{
Col($(ii))[C]$="=Max(This)-Min(This)";
}
@ESC = nOld; //restore @ESC to original value

Note: We must set the value of @ESC to 1 even if it is 1 already, because Origin will internally set it to 2 (by which cell formula is disable) temporarily during the importing.

Keywords:cell fomula, parameter row, calculation during import, label row, set label