Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Recursively search cell for each value within an array and return position within array

$
0
0

I have a bunch of transaction descriptions, and I'd like to check against an array for any matches (case insensitive, in any position within the cell) and return the associated position within the array when successful.

I'm looking to use an array of text values and search a cell for each value within the array, returning the position within the array as the "found" result, on Google Sheets.

For example, I have a budget spreadsheet, with a series of transactions, like:

COLES - Visa PurchaseWWW.ALHGROUP.COM* ME&U - Visa PurchaseMY BUNNINGS - Visa Purchase ALH VENUES - Visa PurchaseALDI STORES  - Visa PurchaseQUIKSILVER - Visa Purchase ALDI STORES  - Visa PurchaseCOLES EXPRESS - Visa Purchase

and I have a named range ("categories") of

search_valreturn_cat
WoolworthsGroceries
ColesGroceries
ALHPub
AldiGroceries
BunningsHome

So, basically I want Google Sheets to search my transaction list for any of the items within search_val (not case sensitive, and in any position of the cell - so similar to an iferror(search(search_val,A1)) and return the position within the array so I can lookup the return_cat. Is this possible?

So I'd end up with

transactionreturn_cat
COLES - Visa PurchaseGroceries
WWW.ALHGROUP.COM* ME&U - Visa PurchasePub
ALH VENUES - Visa PurchasePub
MY BUNNINGS - Visa PurchaseHome
ALDI STORES - Visa PurchaseGroceries
QUIKSILVER - Visa PurchaseNot found
ALDI STORES - Visa PurchaseGroceries
COLES EXPRESS - Visa PurchaseGroceries

Many thanks! My first time in WebApps, let me know please if you think this belongs in another exchange.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>