Extracting Certain Numbers for a String

ib2013

New Member
Joined
Mar 17, 2016
Messages
2
Hi,

I have a set of string that contain different years at different parts of the string. There is no other occurence of a 4 digit numeric value in the string and I wondered if its possible just to extract the date. Example below

A Random Wine 2012
2013 Another Wine

Either VBA or Formula would work

Any help would be appreciated
 
My formula in post #3 should not be used.
Well, I'm not so sure such a blanket rule should be applied. If the OP knows there are no other digits in their data apart from the 4 they are interested in then your formula, or possibly even Dave's may be fine, especially if they do not want to (or are not allowed to) use vba with Rick's suggestion.
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Yes, it's always risky testing for numericalness of strings of greater than length one, mainly due to the reasons pointed out my Peter. Much safer is to check for numericalness on a character-by-character basis, e.g.:

=MID(A1,MATCH(6,MMULT(ABS(ISNUMBER(0+MID(MID("ζ"&A1&"ζ",ROW(INDEX(A:A,1):INDEX(A:A,LEN(A1)-3)),6),{1,2,3,4,5,6},1))-{1,0,0,0,0,1}),{1;1;1;1;1;1}),0),4)

which, incidentally, does not require CSE.

Extracting Numbers of Set Length Only from Alphanumeric Strings « EXCELXOR

Regards
 
Upvote 0

Forum statistics

Threads
1,213,558
Messages
6,114,297
Members
448,564
Latest member
ED38

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