Without any additional knowledge (ie a response from my comment above), this is the best I could come up with.
I would like to recommend using default column settings based on folders as an alternative solution to prevent as much human error in title names. This pushes values to specific columns in your files depending on what folder they're placed into. From there you can have views that strip your documents out of folders but still hold the necessary metadata involved. A brief tutorial can be found here.
On with the real answer:
The issue you were primarily having is that Search returns an error when the value is not found. So doing a nested if statement requires checking for said errors in the format
=IF(
NOT(ISERR(<search-function>)),
<if-true>,
<if-false>
)
Also a bit more information filtering was added in my below function. Primarily searching for the word you specified by adding a space on either end. Otherwise words like national would match with nationalist which may not be desired and give the wrong result. Then I made the whole section UPPERCASE so any filtering in SharePoint can be done with a single filter option since you won't have to filter by sec, Sec, SEc, etc due to human error.
Excel string (Where A1 was the title of the document):
=UPPER(
IF(
NOT(ISERR(SEARCH(" sec ",A1))),
TRIM(MID(A1,SEARCH(" sec ",A1)-2,6)),
IF(
NOT(ISERR(SEARCH(" national ",A1))),
TRIM(MID(A1,SEARCH(" national ",A1)-2,11)),
IF(
NOT(ISERR(SEARCH(" set's ",A1))),
TRIM(MID(A1,SEARCH(" set's ",A1)-2,8)),
IF(
NOT(ISERR(SEARCH(" shq",A1))),
TRIM(MID(A1,SEARCH(" shq ",A1)-2,6)),
""
)
)
)
)
)
SharePoint translation:
=UPPER(
IF(
NOT(ISERR(SEARCH(" sec ",Title))),
TRIM(MID(Title,SEARCH(" sec ",Title)-2,6)),
IF(
NOT(ISERR(SEARCH(" national ",Title))),
TRIM(MID(Title,SEARCH(" national ",Title)-2,11)),
IF(
NOT(ISERR(SEARCH(" set's ",Title))),
TRIM(MID(Title,SEARCH(" set's ",Title)-2,8)),
IF(
NOT(ISERR(SEARCH(" shq",Title))),
TRIM(MID(Title,SEARCH(" shq ",Title)-2,6)),
""
)
)
)
)
)
Rbefore the section? What about poor user input? Why can't the user just be prompted to put the data in fields themselves?