ce
ce copied to clipboard
How to use IF function compare string in a json file
Hi team, I declared a IF function like
var IF = function(test, then_value, otherwise_value) {
return test ? then_value : otherwise_value;
};
I want to use json file to store data and i use it to calculate value of a cell like
"=IF(K1=="somevalue", 1, 2)" and it doesn't work
When I change double quotes to single quote like
"=IF(K1=='somevalue', 1, 2)" , it still not working
When I escape double quotes by backslash key(\) like
"=IF(K1==\"somevalue\", 1, 2)" , it only work when defined in javascript array, when i defined in json file, when loaded, jexcel change to "=IF(K1=="somevalue", 1, 2)" so it's not working.
Anyone help me? Thank
Sorry, today i test with "=IF(K1==\"somevalue\", 1, 2)" and it works, i don't know.