Al escribir fórmulas debemos evitar siempre que podamos anidar funciones SI (sobre todo cuando tenemos información que se repite).
Por favor, prueba la siguiente fórmula:
=SI.ERROR(
LET(
id, B3,
fecha_ref, F3,
rango_ids, '[Base Snte 05 Coah 2.xlsx]Pagos'!$F$2:$F$10000,
rango_fechas, '[Base Snte 05 Coah 2.xlsx]Pagos'!$K$2:$K$10000,
rango_resultado, '[Base Snte 05 Coah 2.xlsx]Pagos'!$D$2:$D$10000,
diferencia, ABS(rango_fechas - fecha_ref),
filtro, (rango_ids = id) * diferencia,
min_dif, MIN.SI.CONJUNTO(diferencia, rango_ids, id),
fila, COINCIDIR(min_dif, filtro, 0),
INDICE(rango_resultado, fila)
),
"No encontrado")Coméntanos si funciona.
Por
Sergio, · publicado
Estoy intentando que una macro se active en una fecha determinada cada año pero no consigo completar le parte que resalto en rojo.
Sub DESCATALOGAR()
Call CONEXIONBBDD
Dim sqlX As String
Set rstX = New ADODB.Recordset
Dim sqlY As String
Set rstY = New ADODB.Recordset
'Dim curso As Date
If Day(Date) = 9 And Month(Date) = 9 Then
'On Error Resume Next
sqlX = "UPDATE LIBROS SET LIBROS.Descatalogado = True;"
With rstX
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open sqlX, cnn, , , adCmdText
End With
' curso = Year(Date) & "/" & Right(Year(Date) + 1, 2)
sqlY = "UPDATE LIBROS SET LIBROS.Descatalogado = False WHERE (((LIBROS.Ciclo)='" & User_FechaF.Text_Fecha & "'));"
With rstY
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open sqlY, cnn, , , adCmdText
End With
End If
Set rstX = Nothing
Set rstY = Nothing
End Sub
Alguien me puede echar una mano por favor.