Forum Discussion
Calculated column with check if column value contains a string
- Jan 29, 2024
AndreaPJ Are you getting the syntax error while using first formula you shared in your question? Or it is not returning correct results as expected.
Note:
- Sometimes comma( , ) does not work in formula (it is based on language or regional settings on your site). So in that case use semicolon( ; ) instead of comma( , ).
- Use correct display name of your SharePoint columns in above formula.
- Wrap column names inside [] if your column name has space in it. For example: [My Column Name].
If it is an issue due to comma, try using formula like:
=IF(ISERROR(FIND("CD";[Format]));"XX";"CD")
OR try using this once (with comma and with semicolon):
=IF(ISNUMBER(FIND("CD",[Format])),"CD","XX")
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
=IF(ISERROR(FIND("CD";[Format]));"XX";"CD"))
Just for information: the "display name" is also fine ("internal name" would be field_4) .
Very good!
Now I'd like to make a nested "if".
If there is the string "CD" in the Format field, then write "CD", otherwise, If there is ALSO the string "LP" in the same field, then write "LP". What is the fastest way to make nested "ifs" in calculated columns? T
thank you very much again
AndreaPJ Try calculated column formula like this:
=IF(ISERROR(FIND("CD";[Format]));IF(ISERROR(FIND("LP";[Format]));"XX";"LP");"CD")
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- AndreaPJJan 31, 2024Copper ContributorThanks again,
It works great; I also added an "AND" condition and got the result I wanted.
Very kind
=IF(ISERROR(FIND("CD";[Format]));
IF(AND( ISERROR(FIND("LP";[Format]));ISERROR(FIND("10";[Format]));ISERROR(FIND("12";[Format]));ISERROR(FIND("7";[Format])) );
"MC";"VINYL");
IF(ISERROR(FIND("LP";[Format]));
"CD";"VINYL"))