ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Finding Text within an Array (https://www.excelbanter.com/excel-discussion-misc-queries/448824-finding-text-within-array.html)

Stephan Grunwald

Finding Text within an Array
 
Hi all,

I'm a bit of a MS novice so I apologize if the following question is mundane.

I have an array (A1:A25) and I have written a formula in each cell that ensures only one cell will populate with text. All other cells that do not match the criteria will populate as blank cells.

My question is, how would I go about searching for the cell that contains the text and then returning the text from the cell? The text is dependent on other cells, so I cannot just set one cell equal to another.

Please let me know if I need to elaborate more.

zvkmpw

Finding Text within an Array
 
I have an array (A1:A25) and I have written a formula in each cell that
ensures only one cell will populate with text. All other cells that do not
match the criteria will populate as blank cells.

My question is, how would I go about searching for the cell that contains the
text and then returning the text from the cell?


You could concatenate all the cells. Since only one is non-blank, that returns its text.

Ron Rosenfeld[_2_]

Finding Text within an Array
 
On Thu, 30 May 2013 08:15:02 -0700 (PDT), Stephan Grunwald wrote:

Hi all,

I'm a bit of a MS novice so I apologize if the following question is mundane.

I have an array (A1:A25) and I have written a formula in each cell that ensures only one cell will populate with text. All other cells that do not match the criteria will populate as blank cells.

My question is, how would I go about searching for the cell that contains the text and then returning the text from the cell? The text is dependent on other cells, so I cannot just set one cell equal to another.

Please let me know if I need to elaborate more.


In addition to the concatenation idea advanced by zvkmpw, you could also use this formula:

=IFERROR(LOOKUP(2,1/(LEN(A1:A25)0),A1:A25),"")

It actually returns the last non-blank cell in the array, but since you only have one, that would be the same cell.
The IFERROR is in case all cells are blank, in which case the LOOKUP function would return #NA

Stephan Grunwald

Finding Text within an Array
 
Hi all,



I'm a bit of a MS novice so I apologize if the following question is mundane.




I have an array (A1:A25) and I have written a formula in each cell that ensures only one cell will populate with text. All other cells that do not match the criteria will populate as blank cells.




My question is, how would I go about searching for the cell that contains the text and then returning the text from the cell? The text is dependent on other cells, so I cannot just set one cell equal to another.




Please let me know if I need to elaborate more.




In addition to the concatenation idea advanced by zvkmpw, you could also use this formula:



=IFERROR(LOOKUP(2,1/(LEN(A1:A25)0),A1:A25),"")



It actually returns the last non-blank cell in the array, but since you only have one, that would be the same cell.

The IFERROR is in case all cells are blank, in which case the LOOKUP function would return #NA


The iferror(lookup(... worked beautifully. Thank you very much!

Ron Rosenfeld[_2_]

Finding Text within an Array
 
On Fri, 31 May 2013 05:35:14 -0700 (PDT), Stephan Grunwald wrote:

The iferror(lookup(... worked beautifully. Thank you very much!


Glad to help. Thanks for the feedback.


All times are GMT +1. The time now is 06:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com