View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
ShaneDevenshire ShaneDevenshire is offline
external usenet poster
 
Posts: 2,344
Default Finding text in a range

Hi,

Since you have only one item per line the following array formula will work:

=INDEX(B$1:N$1,,MATCH(1,N(B2:N2<""),))

This formula is in A2 and assumes that the text entries you want to display
are in the range B1:N1. This formula is array entered (Press
Shift+Ctrl+Enter instead of Enter).

Now it the text you want to return is the text in the cell that has an entry
then:

=INDEX(B$2:N$2,,MATCH(1,N(B2:N2<""),))

--
Thanks,
Shane Devenshire


"Bernard Liengme" wrote:

Assuming there are no other entries in the cells B1 to Z1
=CHOOSE(MATCH(LOOKUP(2,1/(A1:Z1<""),A1:Z1),A1:Z1),"in a","in b","in
c","IBM","in e","in f","in g", "CA")

LOOKUP find the last item, MATCH tell what column it is in, CHOOSE pick the
text
But for 26 columns this will be horrid.

On another sheet (I used Sheet4) in A1:A26 enter the required text. So A4
has IBM and A* has CA
Then use
=INDEX(Sheet4!A1:A26,MATCH(LOOKUP(2,1/(A1:Z1<""),A1:Z1),A1:Z1))

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Always need help asap :-)" <Always need help asap
wrote in message
...
Hello. I'm a fairly new user to Excel and need help with an IF statement.
I've tried using ISTEXT, but that only seems to work with single cells.

I have a spreadsheet several columns wide and in the first column, need to
put a value, based on which column the text is in (There's only 1 item per
line).

Example:
Col A B C D..... J H I ..... W X Y Z
Results Text
Results Text

If the text is in Col. D, I need the result to be "IBM", if it's in Col.
H,
then "CA", etc.
Can someone help me with this, please?