Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9788

Can I substitute an entire value with another value?

$
0
0

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?

I suppose I could do this:

=regexreplace(vlookup(A1,B:C,2,FALSE),"^0$","")

...but that's a bit ugly and probably very inefficient.


Viewing all articles
Browse latest Browse all 9788

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>