View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Need to replace one dynamic variable with another dynamic variable

With entries like the below in Sheet1 in Col A

Col A
fits years 1995-98
fits years 1997-98

and with entires like the below in Col A/B in Sheet2

Col A Col B
1995-98 1995, 1996, 1997, 1998
1997-98 1997, 1998

try the below formula in Sheet1 cell B2

=VLOOKUP(MID(A2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A 2&"0123456789")),15),Sheet2!A:B,2,0)


If this post helps click Yes
---------------
Jacob Skaria


"djreason" wrote:

I have a large file that contains long product descriptions in one workbook
file in say Column C. Within those descriptions, there are year ranges. for
example, a description may say "fits years 1995-98". These descriptions
change for every product I am listing. What I need to do is change the
1995-98 to read 1995, 1996, 1997, 1998 instead.

On a second workbook, I have listed all of the possible shortened year
ranges (1995-98) in column A. In Column B, I have the expanded year ranges
(1995, 1996, 1997, 1998).

My question is, how can I write a function statement that looks line by line
through Column C on Worksheet 1 for the dynamic shortened year ranges, then
looks for the same value from column A worksheet 2 and replaces with the
expanded year ranges from column B on worksheet 2?

I really dont want to have to do a replace individually line by line.

Thanks in advance for any help.