Change cell math value onEditCell

I have a grid, generated from a Json string, that has formulas in columns.
I wish to change the math formula when a user edits the cell.
For example: a cell contains “=a1b1" and when the user edits the cell I wish to change the cell to "=pricehours”.
When the user is finished editing the cell I will change the values back to something like “=a1*b1”.

I’m using the onEditCell event to know when a user edits the cell but I’m not able to set the content of the cell when having a formula in it.

I have tried:
setValue()
setCTxtValue()
setLabel()

I have also tried to, dynamically, change the cell type and other things like:
enableEditEvents()
setCellExcellType()
editCell()
editStop()

What I probably want is a cell.setMath() function.

Is it possible to change the math formula in the onEditCell event?

The math based cells is not editable by design ( value can’t be formula based and custom typed in the same time )

You can enable edit operations for the math cells, but in such case they show formulas, not values
grid.enableMathEditing(true)

If you are using “math” column, normal cell.setValue() must work correctly. It accepts both formulas and static values. In case of calling from onEditCell the safe code will be

some.attachEvent("onEditCell", function(){ setTimeout(function(){ some.editStop(); some.cells(a,b).setValue(c); }); })

I’m unsure if you understand what I want to do.
The math cells are editable (I have set enableMathEditing(true)) but I want to change the math formula before the users sees it.
If a formula is “=a1b1" (the user maybe sees “100”) and clicks the cell, I want to be able to change the formula in the cell to "=priceamount” so the user will see that when starting to edit the cell.
When the user is done editing the cell I want to be able to change the values back from “=priceamount" to "=a1b1” or something like it.

Your solution makes it possible to change the math formula in the cell but then it closes the editor and the user can not change the value.

The solution I found, with the help of your setTimeout(), is this:
(example only shows replace on edit start, not on edit stop as I also will do)

isEditingCell = false;

some.attachEvent("onEditCell", function(stage, rowId, cellIndex, newValue, oldValue) {
        if (stage == 0) {
            if (isEditingCell == false) {
                isEditingCell = true;
                setTimeout(function () {
                    grid.editStop();
                    grid.cellById(rowId, cellIndex).setValue("=price*amount");
                    grid.editCell();
                    isEditingCell = false;
                }, 100);

            }
        }
});

Yep, the above will work.
One more approach will be use from onEditCell stage 1 ( when editor is rendered )

mygrid.editor.getInput().value = "=price * amount";

Can you give me a link to the documentation for the editor object you use in that line of code?

editor is just a reference to currently active editor, if you know id and index of that cell, it is equal to

var editor = grid.cell(id, index);