copy text that contains...

Manolocs

Active Member
Joined
Mar 28, 2008
Messages
340
Hello, I have 5 columns from B,C,D,E,F. Only one contains "<<" followed by text, I want to copy the entire cell that contains "<<" in column H. Any help is more than welcome. Preferably with formula.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
May I clarify a few things? First, are you saying that any one of the columns (but only one) will have a value of << followed by text? So if these are the columns it might be:
B C D E F G H
Jane Mary <<Alice John Michael Alice
Ed Larry Steve <<Harry Ellen Harry

And do you want the text in column H or the text AND the leading <<? Lastly, just to confirm it really is always the first two characters?

If I'm making the correct assumptions about all of the above, it would be...

=if(right(b1,2)="<<",b1,if(right(c1,2)="<<",c1,if(right(d1,2)="<<",d1,if(right(e1,2)="<<",e1,if(right(f1,2)="<<",f1,"what the heck?")))))

if you want to have the contents if the << cell in column H *without* the <<, that will require a bit more, like so:

=if(right(b1,2)="<<",mid(b1,3,X),if(right(c1,2)="<<",mid(c1,3,X),if(right(d1,2)="<<",mic(d1,3,X),if(right(e1,2)="<<",mid(e1,3,x),if(right(f1,2)="<<",mid(f1,3,X),"what the heck?")))))

where X is the max length of the string you would have. So if it were names and the longest is "<<Kenneth" in B1 you could put mid(b1,3,9). I'm pretty sure you could put 100 for that number and not have problems, but that I'm not 100% sure about.

I'll check back to see if this worked for you or if you have any questions!
 
Upvote 0
Hi only one of the columns B,C,D,E,F have the "<<" in front of the text so I want the cell with << to be copied to column H.
 
Upvote 0
Try this:

=INDEX($B$1:$F$1,0,MATCH(">>*",$B$1:$F$1,0))

and if you want to remove the >>:

=SUBSTITUTE(INDEX($B$1:$F$1,0,MATCH(">>*",$B$1:$F$1,0)),">>","")
 
Last edited:
Upvote 0
Sorry - typo! Obviously I meant this:

Try this:

=INDEX($B$1:$F$1,0,MATCH("<<*",$B$1:$F$1,0))

and if you want to remove the >>:

=SUBSTITUTE(INDEX($B$1:$F$1,0,MATCH("<<*",$B$1:$F$1,0)),"<<","")

:rofl:
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
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