0

I need a specific formula that would give me the position of a cell in a column (Data!A:A) based on values form another range (A:A). Those values are strings of numbers that can be found as sub-strings of the values in Data!A:A.

I was able to successfully make a formula that does this for a single row, but I need one that would go through the whole list. What I made was:

=LET(data,Data!$A:$A,
Match(Filter(data,ISNUMBER(Search(A1,data))),data,0))

But when I try to simply wrap in an arrayformula it it gives me wrong answers

=LET(data,Data!$A:$A,
ARRAYFORMULA(IF(A:A="",,
Match(Filter(data,ISNUMBER(Search(A1:A,data))),data,0))))

I made and example sheet to visualize it - https://docs.google.com/spreadsheets/d/1-R-zWDZKarLAAYg4c5drJUolLFII0vSkt5nIuEHsWIA/edit?usp=sharing

Does anyone have an idea how to make it work?

1
  • Please do not present new requirements after you have received an answer. Ask only one question per post. Post a new question instead. Commented Aug 16, 2024 at 13:53

1 Answer 1

0

You may try:

=map(A:A,lambda(Σ,if(Σ="",,index(ifna(xmatch("*"&Σ&"*",to_text(Data!A:A),2),"-")))))

enter image description here

UPDATED:

=map(A:A,lambda(Σ,if(Σ="",,index(index(split(Data!A:A,": ",),,2),xmatch("*"&Σ&"*",to_text(Data!A:A),2)+5))))

UPDATE 2:

= map(A:A,lambda(Σ,if(Σ="",,index(1*(REGEXEXTRACT(Data!A:A,"[\d.-]+")),xmatch("*"&Σ&"*",to_text(Data!A:A),2)+5))))
Sign up to request clarification or add additional context in comments.

9 Comments

Ah, I knew there's gonna be a lambda there 😅 Those are still a little bit over my head, but thank you - it works for the example I provided. Unfortunately I don't understand how your answer works and the position of the row is only a part of what I actually need. I didn't want to overcomplicate the question as I had the other part figured out somewhat, but it doesn't work with the construction you gave me. I will edit the post with more details, if you would like to help me further.
Added updated formula...
It works, thanks a ton! I have only a slight problem in that I the formula picks up commas that appear in the data set. I forgot to up them in the example, sorry about that. The output has to be a number.
replace the index(split(Data!A:A,": ",),,2) part with your working regexextract model
I'm sorry but that doesn't work. That regexextract relayed on finding the row with my method first and that is ineffective. Placing that whole bit into your lambda function doesn't make it work. I get #N/A - no matches found in filter.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.