Formula:
=BUSCARV( [celda con la fecha] , [tabla de fechas ascendentes] ,2,VERDADERO)
Let's go to the specific case. If you have the list of dates in A1:B7
, with the dates in ascending order, that is, in the reverse order you were presenting it to:
| | A | B |
|---|----------|--------|
| 1 | Fecha | Fase |
| 2 | 0 | fase 5 |
| 3 | 10/11/16 | fase 4 |
| 4 | 10/12/16 | fase 3 |
| 5 | 25/12/16 | fase 2 |
| 6 | 9/01/17 | fase 1 |
| 7 | 8/02/17 | fase 0 |
- the first date is 0 to include all dates.
- The rest of the dates are calculated as
=HOY()-90
, =HOY()-60
, =HOY()-45
, =HOY()-30
, and =HOY()
.
- Seeing that the accepted answer was using business days, the dates would be calculated with
=DIA.LAB(HOY(),-90)
, =DIA.LAB(HOY(),-60)
, =DIA.LAB(HOY(),-45)
, =DIA.LAB(HOY(),-30)
, and =HOY()
.
And if you have the table to be generated in D1:E999
| | D | E |
|---|---------------|------------------------------------|
| 1 | Fecha Cliente | Fase |
| 2 | 8/02/17 | =BUSCARV(D2,$A$2:$B$7,2,VERDADERO) |
| 3 | 15/01/17 | =BUSCARV(D3,$A$2:$B$7,2,VERDADERO) |
| 4 | 30/12/16 | =BUSCARV(D4,$A$2:$B$7,2,VERDADERO) |
| 5 | 10/12/16 | =BUSCARV(D5,$A$2:$B$7,2,VERDADERO) |
| 6 | 15/11/16 | =BUSCARV(D6,$A$2:$B$7,2,VERDADERO) |
| 7 | ... | ... |
The formula is applied as seen above.
The important thing of this is that the last parameter of BUSCARV()
in VERDADERO
returns the value of the last row that is not greater than the value sought.
Result: