I've used a couple of Add-ins for regexp in excel, but I wondered if regexp had the ability to test the multiple matches in a single-line expression.  But I guess that does require a multiline program - I'll use VB. Thanks.

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Kyle Banerjee
Sent: Tuesday, July 02, 2013 11:47 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Regular expression for maximum 4-digit number

AFAIK, Excel has no built in regex capabilities so you'd need to call vbscript from Excel to do this.

In any case, you'll need to write an actual program to evaluate each line since multiple values can occur in the same line. This will be easier if done as text than in VBA. Besides, the data in Excel came from Mil in text to begin with.

There are many ways to do what you want, but perl would be hard to beat for this use case

On Jul 2, 2013 10:02 AM, "Harper, Cynthia" <[log in to unmask]> wrote:

> Is there a way to return (in Excel, if possible) the largest 4-digit 
> number (by word boundaries) in a string?  I've extracted the 863 
> fields from Millennium for my active periodicals, and want to find the 
> latest year in each run.  I'm willing to estimate it by taking the 
> largest 4-digit number in the string. I'm doing this in Excel.  Any help?
> Cindy Harper
> Electronic Services and Serials Librarian Virginia Theological 
> Seminary
> 3737 Seminary Road
> Alexandria VA 22304
> 703-461-1794
> [log in to unmask]