excel - Fixing date in sheet (searching for string) -


i have 2 columns values such as:

5 - 11 octubre                             2011 5 - 11 octubre                             2011 5 - 11 octubre                             2011 12 - 18 diciembre                          2011 30 noviembre - 6 diciembre                 2012 30 noviembre - 6 diciembre                 2012 18 - 24 septiembre_2012                    2012 18 - 24 septiembre_2012                    2012 22 - 28 abril_2013                         2013 22 - 28 abril_2013                         2013 

i want take last day , put 1 column such as:

2011/10/11 2011/10/11 2011/10/11 2011/12/18 2011/12/06 2011/12/06 2012/09/24 2012/09/24 2013/04/28 2013/04/28 

but can't find way so. me?

right have this: (the messed date in d , year in i)

sub data() activesheet lastrow = .cells(.rows.count, "a").end(xlup).row end     b = lastrow 1 step -1         cells(b, 4) = application.clean(application.trim(cells(b, 4)))     next     = 1 lastrow  valor = right(range("d2").offset(i, 0).value, 12)  numero = right(range("d2").offset(i, 0).value, 4)  if instr(1, valor, "enero") > 0 range("e2").offset(i, 0).value = "enero" end if  if instr(1, valor, "febrero") > 0 range("e2").offset(i, 0).value = "febrero" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "marzo") > 0 range("e2").offset(i, 0).value = "marzo" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "abril") > 0 range("e2").offset(i, 0).value = "abril" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "mayo") > 0 range("e2").offset(i, 0).value = "mayo" end if   if instr(1, activesheet.range("d2").offset(i, 0).value, "junio") > 0 range("e2").offset(i, 0).value = "junio" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "julio") > 0 range("e2").offset(i, 0).value = "julio" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "agosto") > 0 range("e2").offset(i, 0).value = "agosto" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "septiembre") > 0 range("e2").offset(i, 0).value = "septiembre" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "octubre") > 0 range("e2").offset(i, 0).value = "octubre" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "noviembre") > 0 range("e2").offset(i, 0).value = "noviembre" end if  if instr(1, activesheet.range("d2").offset(i, 0).value, "diciembre") > 0 range("e2").offset(i, 0).value = "diciembre" end if next  end sub 

i'm thinking check if "numero" number , if is, don't know how delete main string... if guys me...

if don't mind using excel formula, use this, assuming date range in cell a1 , year in cell b1:

=(mid(a1,find("-",a1)+2,iferror(find("_",a1)-find("-",a1)-2,30))&" "&b1)*1 

this finds - , uses date , month, stopping @ _ if finds one, , concatenates year. *1 convert string number, , have format column in have formula yyyy/mm/dd.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -