Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Excel: Searching for text within a cell array and returning text from that cell

enter image description here

In A7, I would like to return the number at the beginning of the cell in which I find a certain piece of text. So, for example, if I search for the word "question" I would like to return the number 4.

I have tried using this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

=LEFT(CELL("address",INDEX(A1:A5,MATCH(""&"question"&"",A1:A5,0))),1)

Because CELL("address",INDEX(A1:A5,MATCH(""&"question"&"",A1:A5,0))) returns the cell reference ($A$4), but it takes the cell reference as the text rather than the text in that cell.

Can anyone help?

>Solution :

This formula is not perfect because it cannot handle if there is more than one match or if the number to extract is over 9 but could be a starting point:

enter image description here

Formula in B9:

=LEFT(INDEX($A$1:$A$5,MATCH("*"&B8&"*",$A$1:$A$5,0)),1)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading