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
Hola EXCELENTES.
Heredé este código. Yo no tengo NI IDEA de programación.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errorfecha
If Not Intersect(Target, Range("A1830")) Is Nothing Then
If Range("A1830").Value <> "" Then
If Application.WorksheetFunction.Weekday(Range("A1830").Value, 2) >= 6 Then
On Error GoTo 0
MsgBox "No puede ser sábado o domingo", vbCritical
Range("A1830").EntireRow.Delete
Range("A1830").Select
ElseIf (Range("A1830").Value < Date - 7 Or Range("A1830").Value > Date + 3) Then
MsgBox "No puede superar los siete días", vbCritical
Range("A1830").EntireRow.Delete
Range("A1830").Select
Else
If Not Intersect(Target, Rows("1830:1830")) Is Nothing Then
Rows("3:3").EntireRow.Delete
Target.Offset(0, 1).Select
End If
End If
End If
End If
Exit Sub
errorfecha:
Range("A1830").ClearContents
End Sub
¿Pero que quito para que no proteste por los Sábados y Domingos?.
Muchas gracias y SALU2.