'Convert aggregate function from Excel to Google Sheets

I'm working on a excel that pulls out consecutive capital letters from a cell. It's basically trying to find states abbreviations from any type strings and I got a list of state abbreviations. This is my formula in excel

=MID(A1,AGGREGATE(15,6,FIND(States," "&A1&" "),1),2)

States:

={" AL "," AK "," AZ "," AR "," CA "," CO "," CT "," DE "," FL "," GA "," HI "," ID "," IL "," IN "," IA "," KS "," KY "," LA "," ME "," MD "," MA "," MI "," MN "," MS "," MO "," MT "," NE "," NV "," NH "," NJ "," NM "," NY "," NC "," ND "," OH "," OK "," OR "," PA "," RI "," SC "," SD "," TN "," TX "," UT "," VT "," VA "," WA "," WV "," WI "," WY "}

However, I'm trying to do this in google sheets, does anyone know a conversion for this aggregate function in google sheets?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source