cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lauren_
Helper V
Helper V

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?

---------------------------------------------------------------------------------------------------------------------------


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,904)