loop backwards for searching a string

abhimaan

New Member
Joined
Mar 10, 2012
Messages
5
Hi,

I want to run the loop backwards in order to search a string. The requirement is as below:

[TABLE="width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]A1[/TD]
[TD][/TD]
[TD]game[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]ZOK[/TD]
[TD]name[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD][/TD]
[TD]pen[/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD][/TD]
[TD]mobile[/TD]
[/TR]
[TR]
[TD]A5[/TD]
[TD]KUY[/TD]
[TD]copy[/TD]
[/TR]
[TR]
[TD]A6[/TD]
[TD][/TD]
[TD]shirt[/TD]
[/TR]
[TR]
[TD]A7[/TD]
[TD][/TD]
[TD]rat[/TD]
[/TR]
[TR]
[TD]A8[/TD]
[TD][/TD]
[TD]mat[/TD]
[/TR]
[TR]
[TD]A9[/TD]
[TD][/TD]
[TD]hat[/TD]
[/TR]
</tbody>[/TABLE]


I want to copy the rows from one sheet to another based on the string I am searching.
Lets say if the string I am searching from example above is "hat" in column C and there is no value corresponding to it in cell B9, then a loop should start to search for value in column B starting from B9 till the cell where it finds some value which in this case would be in cell B5 and value is "KUY".

I want to have the code for looping in reverse order.

Any help would be much appreciated.

Thanks,
Abhimanyu
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
With that data set,
=LOOKUP("zzz", INDEX(B:B,1,1):INDEX(B:B, MATCH("hat", C:C, 0), 1))

will return KUY
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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