Search each cell for certain character occurring before a ] and list

Singh_Edm

New Member
Joined
Dec 18, 2013
Messages
30
Hi
I have a 2 Column excel file. 1st column is just the Serial Number in increments of 1. Every cell in 2nd column has Text ending with a square bracket, e.g. ] Sometimes a sentence ends with a number enclosed between two closing square brackets e.g. ]12]
I am looking for help for a VBA Macro that goes through each cell in Column 2 and searches for the occurrence of the following BEFORE the FIRST square bracket.
  1. Any digit: So if there is a cell with the entry, Hello2 How are you]23] then the corresponding serial number from Col 1 should be outputted in a new column. If '2' wasn't there after 'Hello' then the search should not single the serial # out.
  2. Search for any character occurring together more than once e.g. My name is Jammes] Here M occurs twice in Jammes so the corresponding serial number from Col 1 should be output in a new Column.

Even if there are two macros for bullet 1 and bullet 2, that would work.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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