Funciones SEMESTRE, CUATRIMESTRE, TRIMESTRE y BIMESTRE en Excel

Insertamos un módulo en el VBAProject (PERSONAL.XLSB)

Si deseamos que las funciones estén disponible para emplearse en cualquier Libro.

Insertamos un módulo en el VBAProject del Libro en Uso

Si deseamos que las funciones estén disponibles únicamente para emplearse en un libro en especifico. Para identificarlo este lleva el mismo nombre del archivo y una vez que se escriba el código, el archivo debe guardarse como Libro de Excel habilitado para macros.

Copiamos el siguiente código:

Function BIMESTRE(Fecha As Date)
mes = (Month(Fecha) + 0.1) / 2
BI = Round(mes, 0)
BIMESTRE = BI
End Function

Function TRIMESTRE(Fecha As Date)
mes = (Month(Fecha) + 1) / 3
TRI = Round(mes, 0)
TRIMESTRE = TRI
End Function

Function CUATRIMESTRE(Fecha As Date)
mes = (Month(Fecha) + 1.1) / 4
CUA = Round(mes, 0)
CUATRIMESTRE = CUA
End Function

Function SEMESTRE(Fecha As Date)
mes = (Month(Fecha) + 2.1) / 6
SE = Round(mes, 0)
SEMESTRE = SE
End Function

Pegamos y Guardamos el código:

Buscamos las funciones como: SEMESTRE | CUATRIMESTRE | TRIMESTRE | BIMESTRE


Comentarios