Macro to strip off suffixes?

Philip041

Board Regular
Joined
Jul 17, 2011
Messages
63
Hello,

I have got a column of data (with header) and have been writing the following formulae in columns B and C to strip off the stuff I don't want;

=FIND(" ",A2, 4)

=IF(ISERROR(B2),A2,LEFT(A2,B2-1))

Then I copy column C as values into D and I've got my values without any stuff after what I want.

How do I get this into a macro without all the extra columns so it just changes the values in column A?

The values come as "AH something" or "AH something possible other things"

Cheers
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Select your data, choose Edit|Replace, in the What box enter a space followed by *, leave the With box blank and click Replace all. If you record that you will get some VBA code.
 
Upvote 0
Ah, no. I want to get it so it takes off everything after "AH something" all the other somethings that come after I want to remove...
 
Upvote 0
Hi

Using replace. Select the data and

- replace "AH " with "AH"
- replace " *" with "", like Andrew said in post #2
- replace "AH" with "AH "
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,693
Members
452,938
Latest member
babeneker

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