cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lauren_
Advocate IV
Advocate IV

Label, multiple if statement for text

Hey guys, I'm having real problems with understanding if/switch/multiple if statements 😂

 

I'm trying to set up a label text so that depending on whether certain quoted words are in a field, it shows the relevant text. My If statement below has been taken but only shows the first one.

 

If("Analytical Chemistry" in Gallery2.Selected.LabsChosen,"Analytical Chemistry: "&Char(10)&Gallery2.Selected.'Ana-Fulfilment'&Char(10)&Char(10),
("Biochemistry" in Gallery2.Selected.LabsChosen),"Biochemistry: "&Char(10)&Gallery2.Selected.'Biochem-Fulfilment'&Char(10)&Char(10),
("Cell Biology" in Gallery2.Selected.LabsChosen),"Cell Biology: "&Char(10)&Gallery2.Selected.'CB-Fulfilment'&Char(10)&Char(10),
("Microbiology" in Gallery2.Selected.LabsChosen),"Microbiology: "&Char(10)&Gallery2.Selected.'Microb-Fulfilment'&Char(10)&Char(10),
("Molecular Biology" in Gallery2.Selected.LabsChosen),"Molecular Biology: "&Char(10)&Gallery2.Selected.'Molecb-Fulfilment'&Char(10)&Char(10),
("Preparative Chemistry" in Gallery2.Selected.LabsChosen),"Preparative Chemistry: "&Char(10)&Gallery2.Selected.'PrepChem-Fulfilment',
IsBlank(Gallery2.Selected.LabsChosen),"")

12 REPLIES 12

@iwonder  Something like this?

Hey Warren, possibly some wires crossed, been trying to work the function code you gave then realised selecteditems 🙂 It's a single item selection from the gallery, I'm trying to get it to look at the specific strings of words within a single field and if they're there, to display certain text within the label, and if not , not to display the text. There are 6 strings in total I am trying to get it to acknowledge.

HI @Lauren_ ,

Back to basics again - if it is a single value selected, why do you need the two hard returns? Also your initial posted code seems fairly close to the solution except you need

If(
   Gallery2.Selected.xxxx = "Analytical Chemistry",
   LookUp(
       . . . . . .

and Or() || between the arguments instead of And() &&

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,998)