A
A
arsenaljek2021-09-05 13:47:17
excel
arsenaljek, 2021-09-05 13:47:17

If AND. How to write?

61349f06e48f9652895910.jpeg
How to write a condition using the if and construct?
If columns 2,3,4 are 0, then in the first column we substitute "finally sold",
if column 2 = 0, then "sold"
if column 2 <= 2 and column 3 >= 1 and column 4 >= 1 , then we write "buy".
Is there any switch-case for Google Sheets at all? I don’t understand how to use it if you need to fulfill several conditions and the "AND" operator.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2021-09-05
@arsenaljek

If the numbers are non-negative, you can replace "AND" with multiplication, and "OR" with addition - these are their algebraic "equivalents".
for example

If column 2,3,4 = 0, then we substitute "finally sold" in the first column,

=если((b2+c2+d2)=0;"Продано окончательно";"Другой вариант")

Or use "and"
=если(И(b2=0;c2=0;d2=0);"Продано окончательно";"Другой вариант")

if column 2 = 0, then "sold",

=если(c2=0;"Продано";"Другой вариант")
if column 2 <=2 and column 3 >= 1 and column 4 >=1 then we write "buy".

Here you can use AND , in principle
если(И(b2<=2;c2>=1;d2>=1);"докупить";"Другой вариант")

It remains only to put one into the other instead of "Another option"
There is a frail analogue of switch if you use values ​​for the search. For example, to convert the name of the month to its number, you can use the following construction:
=ИНДЕКС({"январь":"февраль":"март":"апрель":"май":"июнь":"июль":"август":"сентябрь":"октябрь":"ноябрь":"декабрь"};A1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question