P
P
podkradulinike2021-09-09 07:45:03
Google Sheets
podkradulinike, 2021-09-09 07:45:03

How to fill a cell with a value if another cell contains certain text?

In cell A1 the text is "red t-shirts"
In A2 "blue hoodies"
In A3 "red sweatshirts"

You want B1-3 to display the correct value depending on what text is contained in A1-3. If the text contains "t-shirts", then display "T-shirt". If the text contains "hoodie", then output "hoodie", etc.

I tried =IFS(SEARCH("t-shirt", A1); "t-shirt"; SEARCH("hoodie", A1); "hoodie") , but only works for "t-shirt".
Tried =IF(SEARCH("t-shirt", A1), "t-shirt"), but I don't know how to add conditions for hoodies and sweatshirts.

Answer the question

In order to leave comments, you need to log in

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

So?

=ЕСЛИ(REGEXMATCH(A1;".*футболк.*");"Футболка"
   ;ЕСЛИ(REGEXMATCH(A1;".*худи.*");"Худи"
      ;ЕСЛИ(REGEXMATCH(A1;".*свитшот.*");"Свитшот"
      ;""
      )
   )
)

Demo table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question