Copying content of cell with special content

Dsuperc

Board Regular
Joined
Apr 3, 2002
Messages
135
I want to copy the contents of cells that are randomly scattered in Column A. to the correcponding cell in column B. They contain text starting with "Agent A or Agent B or Agent C".Could someone help me with a macro that I could just copy and paste
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

gvanbee

New Member
Joined
Jun 26, 2002
Messages
42
I can't give you VBA code, but if you willing to do an equation then:

Cell B1=
If(or(left(a1,7)="Agent A",left(a1,7)="Agent B",left(a1,7)="Agent C"),A1,"")

Leave it as is for dynamic, or copy pastespecial-values to make it static.
 

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
You may want to also consider filtering your list by column A, and using goto special under then edit menu to copy only what you see/want.

Or a template for a formula based approach could be
=IF(OR(LEFT(A1,7)={"agent A","agent B","agent c"}),A1,"")

good luck
 

gvanbee

New Member
Joined
Jun 26, 2002
Messages
42
Thanks for the kind way of correcting my inefficient equation. I always new there had to be a better way of writing a redundant or(..)

If I only new it about 62 spreadsheets ago.
 

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
If I only new it about 62 spreadsheets ago.

Ha! Boy do I know that feeling!

Just as an aside, if your list grows any more than 2 or 3, I would personaly alter to formula to something along the lines of
=IF(ISNUMBER(MATCH(LEFT(A1,7),mylist,0)),A1,"")

where mylist is a named range containing your bogey values.
 

Forum statistics

Threads
1,144,219
Messages
5,723,076
Members
422,477
Latest member
pete101

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
Top