Explore watchlist to find specific word from Notepad using NoteGet

I am trying to explore a watchlist and wants to display only stocks which contains 'Excellent' word in the notepad. The following is the AFL.

Notepad = ExcelWord = "" ; // String variables 
Notepad = NoteGet( "" ) ; 
ExcelWord = StrFind( Notepad, "Excellent" )  ; // find excellent word
if( ExcelWord > 0 ) // find first ocurrance of Excellent
 AddColumn(ExcelWord ,  "ExcelWord  ",1.0);
 AddTextColumn( Name(), "Symbol Name",1.0,colorBlack,colorLime,200);
      

Even though few stock's notepad does contain 'Excellent' word, the result page doesn't show empty. The String variable 'ExcelWord' gives the correct result. Only issue is the list is empty.

First, AFL is NOT PYTHON. Indentation is not block marker as in Python.

AFL is like C/C++, to mark block you use BRACES { }

Secondly, AddColumn is for entire exploration, so it can't be "conditionally" added for symbol "A" but not for "B" because column is a column, it is for ENTIRE EXPLORATION.

Thirdly, you are missing Filter statement

What you can do instead is just 4 lines

Notepad = NoteGet( "" ) ; 
ExcelWord = StrFind( Notepad, "Excellent" )  ; // find excellent word
Filter = Status("lastbarinrange") AND ExcelWord;
AddTextColumn( Name(), "symbol name" );

You REALLY need to read the manual on exploration:
https://www.amibroker.com/guide/h_exploration.html