How do I write the following explanation in excel formula? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I write the following explanation in excel formula?

Suppose I am working on A1, B1 and the formula is being written in C1: If A1 is equal to B1 then C1 is 4 else -1, if A1 is blank then C1 is 0 ( Where, B1 can never be empty ) I am able to write the formula for the first logic but unable to merge with second, and as I am working on 75 such columns so I wanted to generalize it...

16th May 2020, 5:49 AM
Arun Bhattacharya
Arun Bhattacharya - avatar
2 Answers
+ 3
Excel appears to support nested if functions. https://www.techonthenet.com/excel/formulas/if_nested.php You can then combine this with the check for blank. https://exceljet.net/formula/if-cell-is-blank I imagine the formula for C1 would look something like this: IF(A1=B1, 4, IF(A1="", 0, -1)) on the assumption that assigning 0 to A1 on blank takes precedence over assigning -1 on A1 not equals to B1. I don't have Excel with me at the moment so I can't try this. Sorry if I made any mistakes.
16th May 2020, 5:58 AM
Fermi
Fermi - avatar
+ 1
Maybe VBA is to apply
16th May 2020, 6:19 AM
Oma Falk
Oma Falk - avatar