View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dallman Ross Dallman Ross is offline
external usenet poster
 
Posts: 390
Default search cells in multiple columns of same row

I don't know about the populating-a-cell part of your request.
I believe you will need a macro or VBA code for that part, and
others here could help with that. But as for finding *where*
the put the X, this formula should work as one way:

=ADDRESS(MATCH("X",OFFSET(INDIRECT(MATCH("Went up the hill",G1:G3,0)&":"&MATCH("Went up the hill",G1:G3,0)),-1,),0)+1,MATCH("Went up the hill",G1:G3,0))

(Replace "Went up the hill" with the real text that's in Column G.
Replace G1:G3 with the actual range.)

Question: what if the X in the previous line is in Column F?
Then we can't move it one more to the right; the text strings
are there. I hope you don't want it to go back to A then. That
means more work on the above formula.

Actually, I fully expect one of the macro geniuses here to do this
all with a macro rather than messing with a formula. But I was
curious as to whether I could find where to place your X with a
formula.

-dman-

==================================
In .com, jsd219
spake thusly:

I am trying to write a script that looks for a cell with specified text
in a specified column, once it finds the cell it needs to check six
different columns (a,b,c,d,e,f) one row above and find the column that
has an "x", it then needs to place an "x" in its row one column to the
right form the previous "x"

example: if it finds the cell with "Went up the hill" the script needs
to look up one row and check columns (a,b,c,d,e,f) until it finds the
"X".

In this case it will find the "X" on the row with "JACK AND JILL" in
column "a" so it will place an "X" for the row "Went up the hill" (the
orginal cell searched for) in column "b"

a b c d e f g
X JACK AND JILL
Went up the hill
To fetch 3.5 Pales of Water