I want to replace one value with another. For instance, if the result of an expression is 0, I want to replace it with an empty string. I don't want to repeat the expression, or use an intermediate cell.
For example, instead of this:
=IF(VLOOKUP(A1,B:C,2,FALSE)=0,"",VLOOKUP(A1,B:C,2,FALSE))
I would like something like this, if there were a "CASE" function that did what I want:
=CASE(VLOOKUP(A1,B:C,2,FALSE),0,"")
Is there a function or syntax that does this? Basically just like switch
but without the last "default" parameter. I want the default to be the value being checked, without having to repeat the expression.
I suppose I could do this:
=regexreplace(vlookup(A1,B:C,2,FALSE),"^0$","")
...but that's a bit ugly and probably very inefficient.