Ask Your Question
0

Is there an IFS type function for text? (if A1 is blank, use B1, etc.) [closed]

asked 2020-09-09 00:43:03 +0200

yarow12 gravatar image

Is there a function for using the first non-blank text expression the result? I attempted to use the SWITCH function, but it seems restricted to a single expression (e.g.: A1). Below is my attempt before testing with text expressions. It works for numeric ones.

=IFS(AND(N6="",O6<>""),O6,AND(O6="",P6<>""),P6,AND(P6="",Q6<>""),Q6,AND(Q6="",R6<>""),R6,AND(R6="",N6=""),"",N6,N6)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by yarow12
close date 2020-09-09 04:06:19.852934

2 Answers

Sort by » oldest newest most voted
1

answered 2020-09-09 01:32:06 +0200

newbie-02 gravatar image

yes, it is, (imho)

=IFS(A3<>"";A3; A4<>"";A4; A5<>"";A5)

add more cases as you like ...

"nested if's" would work as well, but often confuse coders once there are too many parentheses ...

P.S. 'solved marks' and 'likes' welcome,
click the grey circled hook - ✓ - top left to the answer to turn it green if the problem is solved,
click the "^" above it if you 'like' the answer,
"v" if you don't,
do not! use 'answer' to add info to your question, either edit the question or add a comment,
'answer' only if you found a solution yourself ...

edit flag offensive delete link more

Comments

This worked, thanks. I just had to end the loop by adding something to the end (see below).

=IFS(N6<>"",N6, O6<>"",O6, P6<>"",P6, P6="", "")
yarow12 gravatar imageyarow12 ( 2020-09-09 04:03:40 +0200 )edit
1

answered 2020-09-09 01:27:02 +0200

igorlius gravatar image

updated 2020-09-09 09:16:26 +0200

Hello,

this should work

=IFERROR(IFS(NOT(ISBLANK(A1)),A1,NOT(ISBLANK(B1)),B1),"all empty")

image description

Hope that helps.

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Have a nice day and let's (continue to) "Be excellent to each other!"

edit flag offensive delete link more

Comments

1

I couldn't get this to work for me. Took out the "..." and then the 2nd to last line, but I kept getting an Err:50x result.

yarow12 gravatar imageyarow12 ( 2020-09-09 04:06:03 +0200 )edit
1

I guess the Linebreaks were your problem, i guess i should have places the example in one line, ... i'll fix it But newbie-02 example is a little shorter with the <> operator, so i guess that makes it a bit more appealing.

igorlius gravatar imageigorlius ( 2020-09-09 09:15:03 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2020-09-09 00:43:03 +0200

Seen: 63 times

Last updated: Sep 09 '20