I have a large csv file imported to a worksheet. From this I extract data to a separate Analysis worksheet to create the columns I need by using '=' to look up the data from the csv worksheet. So for example W1 in the csv worksheet = C1 in the analysis worksheet etc, which contains the random text string from the csv worksheet. I have created a column in the analysis worksheet (AD) which contains the text strings I need to search for, which returns text (an instruction) contained in a third column (AE).
Using a lookup formula from Eric W https://www.mrexcel.com/board/members/eric-w.338656/ (to whom many thanks) I am able to interrogate the random text using the formula
=LOOKUP(2,1/SEARCH($AD$3:$AD$45,"*"&C3&"*"),$AE$3:$AE$45)
Where column AD contains the search string to be searched for, column C is the random text string containing the text in column AD to be searched, and column AE contains the text to be returned if column C contains the text in column AD. This formula is in column D and is copied down the whole of column D. This works perfectly well for two other pairs of search strings and responses in other columns, so the formula works. However for the third pair it returns inconsistent responses. This seems to be based on the formatting of the cells in column C, but this is inconsistent.
It works for one search string (out of 43 in column AD) wherever that search string occurs in the text to be searched in a cell in column C (ie by itself, in the middle of the text string, or at the end of it). The rest return #N/A. But if I copy and paste any search string text from column AD into text in column C (the text to be searched) it returns the correct response. The same occurs if I type the search string into column C manually. So the formula can find the correct text string and return the correct response if the input is manual. I have tested this by replacing the text to be searched (column C) with all the search text (column AD) and in every instance the formula returns the correct response from column AE. So this does not appear to be a formula error.
I have tried formatting the columns as 'General' and 'Text' and this makes no difference. I have checked that the search string column (AD) and the response column (AE) are the same length (43 cells). The formula is consistent throughout. But the formula only returns the correct solution from column AE if it is either one particular text string in column AD (which does not seem to have any unique characteristics, it's just a text string), or the search string text is copied and pasted into column C, although the identical text is already in column C.
Any ideas anyone?
Many thanks
HT
Using a lookup formula from Eric W https://www.mrexcel.com/board/members/eric-w.338656/ (to whom many thanks) I am able to interrogate the random text using the formula
=LOOKUP(2,1/SEARCH($AD$3:$AD$45,"*"&C3&"*"),$AE$3:$AE$45)
Where column AD contains the search string to be searched for, column C is the random text string containing the text in column AD to be searched, and column AE contains the text to be returned if column C contains the text in column AD. This formula is in column D and is copied down the whole of column D. This works perfectly well for two other pairs of search strings and responses in other columns, so the formula works. However for the third pair it returns inconsistent responses. This seems to be based on the formatting of the cells in column C, but this is inconsistent.
It works for one search string (out of 43 in column AD) wherever that search string occurs in the text to be searched in a cell in column C (ie by itself, in the middle of the text string, or at the end of it). The rest return #N/A. But if I copy and paste any search string text from column AD into text in column C (the text to be searched) it returns the correct response. The same occurs if I type the search string into column C manually. So the formula can find the correct text string and return the correct response if the input is manual. I have tested this by replacing the text to be searched (column C) with all the search text (column AD) and in every instance the formula returns the correct response from column AE. So this does not appear to be a formula error.
I have tried formatting the columns as 'General' and 'Text' and this makes no difference. I have checked that the search string column (AD) and the response column (AE) are the same length (43 cells). The formula is consistent throughout. But the formula only returns the correct solution from column AE if it is either one particular text string in column AD (which does not seem to have any unique characteristics, it's just a text string), or the search string text is copied and pasted into column C, although the identical text is already in column C.
Any ideas anyone?
Many thanks
HT