I spoke too soon, the above suggestion does not solve the problem. The WFD-Training-Calendar.Title text is red for every title (even those that are correct) unless the lookup field of the same record has the correct title (from the other list WFD-Training-courses) as its value. I would expect the indexof to scan all possible values within the training course list.
Sharepoint column background using indexof
I have a text field that I want to verify (and change background colour accordingly) against either a lookup field in the same list or alternatively directly with the other list being used as the lookup. So far I have this
The text field is in the list WFD-Training-Calendar.Title and the lookup values I want to check against are in another list 'WFD Training courses'.Title The calendar also has a lookup column called 'TrainingCrsLookup' which looks up 'WFD Training courses'.Title so there are options. So far the text in the calendar title field all goes blank and I want non matches to have a red background.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"style": {
"background-color": "=if(indexOf('[$Lookup trng crs title]'.Title, @currentField) == -1, 'red', '')"
},
"children": [
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}