Zuzanna
Zuzanna

Reputation: 11

How can I combine two actions if condition is false in Excel?

I need a help with one Excel problem. I have a formula that is testing few conditions and when it is True it works as I want it to. Although, I can't figure out how to make a cell be a particular value but also change a content of the next one if condition is False.

I tried using nested Substitute formula but it only works for the cell that you are in so this wasn't successful.

Upvotes: 1

Views: 343

Answers (1)

JvdV
JvdV

Reputation: 75900

With ms365, you could try the following:

=IF(<YourCondition>,<Value>,{<Value1>, <Value2>})

This would then spill two values to the right if condition is FALSE and just a single one if condition is TRUE. For example:

enter image description here

Formula in B1:

=IF(A1,"a",{"b","c"})

This can be further expanded into using actual calculations or any sort of statement using CHOOSE(), for example:

enter image description here

Formula in B1:

=IF(A1,D1,CHOOSE({1,2},D1*3,D1*5)

If available the same can be achieved through using HSTACK():

=IF(A1,D1,HSTACK(D1*3,D1*5))

Upvotes: 1

Related Questions