How to retrieve a non-blank text value in an array of text values where only one value is non-blank text

landish

New Member
Joined
Sep 27, 2010
Messages
12
Hi everyone, I've got an array of text values like this {"","","","words,""} HOWEVER I don't know "words" value's position in the array it might look {"","","","",words} or {"","words,"","",""}. I need to retrieve only "words" value using formula functions. It can be done either by merging all the values in the array or by sorting values so "words" value is in the first position then I can use T() function. But I can't find any function or combination of functions to do this. Thank you in advance.
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi everyone, I've got an array of text values like this {"","","","words,""} HOWEVER I don't know "words" value's position in the array it might look {"","","","",words} or {"","words,"","",""}. I need to retrieve only "words" value using formula functions. It can be done either by merging all the values in the array or by sorting values so "words" value is in the first position then I can use T() function. But I can't find any function or combination of functions to do this. Thank you in advance.

=LOOKUP(REPT("z",255),Reference)

is the fastest formula to fetch that single non-blank text bit wherever it is.

Note. Reference can be either an array like {"","","Kazan",""} or a range like A2:A10 or A:A.
 
Last edited:
Upvote 0
Amazing, it works! Thank you very much!!! :)

If you do have formula blanks (formula cells returning ""), the suggestion I made won't work as it would return "" if that's the last value in the reference of interest. Jon's suggestion would indeed return the last non-blank text as would the following:

=LOOKUP(9.99999999999999E+307,SEARCH("?*",A1:H1),A1:H1)
 
Upvote 0
Yes, actually I didn't get how to solve this problem in your way. I was going to ask why I need to use nested REPT function. But anyway thanks, I was searching for the main function which is LOOKUP that makes it possible to retrieve data from array. You and Jon both used this function. I am really grateful to Jon. His example works best.


If you do have formula blanks (formula cells returning ""), the suggestion I made won't work as it would return "" if that's the last value in the reference of interest. Jon's suggestion would indeed return the last non-blank text as would the following:

=LOOKUP(9.99999999999999E+307,SEARCH("?*",A1:H1),A1:H1)
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top