D
D
Dmitry Shalimov2019-11-06 09:54:09
excel
Dmitry Shalimov, 2019-11-06 09:54:09

How to write a search formula for text in a cell case sensitive?

At the very first glance, the task before me was not the most difficult.
You need to understand what properties are entered in the cell (Text separated by commas).
The difficulty is that some properties are part of other properties. (Key - "Key" will react to "Key", and to "Key Keeper", and to "Keys from the intercom".
I wrote this function

=OR(ARRAYFORMULA(EXACT($K$1;{SPLIT($D2;", ";0;1)})))

Where K2 is the property that we are trying to find in the list, D2 is a cell from the column in which the properties are specified separated by commas.
It sort of breaks perfectly, though it needs to be stretched, and this is no longer the right approach! (There would be a will, in general, I wrote all the formulas in 1 cell)
Then I followed the classic array formula template and somehow it doesn’t work.
={"Key";ArrayFormula(IF(OFFSET(B1;1;;COUNT(A2:A))<>"";OR(ARRAYFORMULA(EXACT("Key";{SPLIT(OFFSET(D1;1;;COUNT (B2:B));", ";0;1)}))))))}

The problem is that in the Google spreadsheet it is not possible to view the sequence of calculations, and to say exactly what the jamb is here ... But if I understand the code I wrote correctly, then the split function does not just cut the cell into components, but step by step each cell of the column, and from there it follows that the truth will be in the event that the key occurs not specifically in the cell at the same level as the calculated one, but in the whole column, which is fundamentally wrong.
Does anyone have any idea how to spell it correctly?
https://docs.google.com/spreadsheets/d/1EWTcSXY6iX...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2019-11-09
@Akui_Aru

If the religion allows the use of scripts, then this will work:

/**
 * Возвращает true, если value содержится в inData как ключ с разделителем delimiter
 *
 * @param {A:A} inData Исходный массив или одиночная строка
 * @param {"key"} value Значение, которое ищется среди слов
 * @param {1} delimiter Разделитель слов. По умолчанию - ","
 * @return Возвращает true, если inData - одиночное значение или аналогичный массив, если inData - диапазон
 * @customfunction
 */
function isContainText(inData,value,delimiter) {
  var delimiter = delimiter || ",";
  if (inData.map){
    return inData.map(function(el){return isContainText(el,value,delimiter)});
  }else{
    var data = inData.split(delimiter);
    if (!data) return false;
    return data.indexOf(value)!=-1;
  };
}

Usage:
=isContainText(A:A;"Ключ";",")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question