Home > Software design >  Show "Weekend" if another cell contains specific text
Show "Weekend" if another cell contains specific text

Time:01-20

I have a list of dates in Column 1, which I have formatted as custom date. 1/1/2023 for example shows as Sunday 1

I need to have other cells in the table show "Weekend" if the cell in column 1 contains Saturday or Sunday

The following formula works for one of them:

=IFERROR(IFS(SEARCH("Saturday", A2), "WEEKEND"), "")

But I need it to search for both Saturday and Sunday. I've tried the following but it's not working:

=IFERROR(IFS(SEARCH("Saturday", A2), "WEEKEND"), "None",(SEARCH("Sunday", A2), "WEEKEND"), "None")

CodePudding user response:

try:

=INDEX(IF(LEN(A:A),IF((WEEKDAY(A:A)=1) (WEEKDAY(A:A)=7),"WEEKEND",),))

enter image description here

CodePudding user response:

If you actually have text, you can use wildcards:

=IFERROR(IF(SEARCH("S*DAY",A2),"WEEKEND",),)

Also applicable for INDEX or ARRAYFORMULA

=INDEX(IFERROR(IF(SEARCH("S*DAY",A2:A),"WEEKEND",),))
  • Related