I have created a rather complex formula to parse out some text data into a specific format. I would like to be able to store this as a function and/or be able to apply this formula as a macro to a long list using a FOR EACH...NEXT statement.
How can I save this formula as either a function or a macro that would allow me to desginate the data cell (A2 in this example) and apply it to any cell I designate?
the following is a concatenation of 3 formulas and one text character
=LOWER(LEFT(A2,1) &
IF(OR(MID(A2,FIND("-",A2)+1,1)="1",MID(A2,FIND("-",A2)+1,1)="2",MID(A2,FIND("-",A2)+1,1)="3"),MID(A2,FIND("-",A2)+1,2),CONCATENATE("0",MID(A2,FIND("-",A2)+1,1))))&
"_"&
LOWER(IF(MID(A2,FIND("-",A2)-4,1)=" ",CONCATENATE("0",MID(A2,FIND("-",A2)-3,3)),MID(A2,FIND("-",A2)-4,4)))
The data looks like this:
mesa unit 5a1-6d
Mesa 15D4-8
Mesa Unit 15A3-8
Stewart Point 9C2-8
Mesa 9D3-17
Results Look like this:
m06_05a1
m08_15d4
m08_15a3
s08_9c2
m17_09d3
Perhaps I need both a function and then I can apply that function as a macro to any column I choose.
thanks
How can I save this formula as either a function or a macro that would allow me to desginate the data cell (A2 in this example) and apply it to any cell I designate?
the following is a concatenation of 3 formulas and one text character
=LOWER(LEFT(A2,1) &
IF(OR(MID(A2,FIND("-",A2)+1,1)="1",MID(A2,FIND("-",A2)+1,1)="2",MID(A2,FIND("-",A2)+1,1)="3"),MID(A2,FIND("-",A2)+1,2),CONCATENATE("0",MID(A2,FIND("-",A2)+1,1))))&
"_"&
LOWER(IF(MID(A2,FIND("-",A2)-4,1)=" ",CONCATENATE("0",MID(A2,FIND("-",A2)-3,3)),MID(A2,FIND("-",A2)-4,4)))
The data looks like this:
mesa unit 5a1-6d
Mesa 15D4-8
Mesa Unit 15A3-8
Stewart Point 9C2-8
Mesa 9D3-17
Results Look like this:
m06_05a1
m08_15d4
m08_15a3
s08_9c2
m17_09d3
Perhaps I need both a function and then I can apply that function as a macro to any column I choose.
thanks