Given an excel sample data as follows:
For NA cells in column B (which means B3 and B5), I'll need to fill with values in column A.
I write a simple formula for cell B3: =IF(ISNA(B3),A3,B3) (equivalent to df['b'].fillna(df['a']) in Pandas), but returns 0. How could I write a proper formula to solve this issue? Thanks.
The expected result should be like this:
CodePudding user response:
A cell can contain either a value or a formula, which is why you should create an extra column for the result. NA in excel is an error code and does not indicate that a cell is blank. You should use the formula =IF(ISBLANK(B3),A3,B3) in column C
CodePudding user response:
I think you get the "Circular dependency detected" error. The easy solution is:
- copy the column b in the column c
- fill the na value in the column c with the formula that you defined



