smide
Board Regular
- Joined
- Dec 20, 2015
- Messages
- 164
- Office Version
- 2016
- Platform
- Windows
Hello.
In cell B1 I have current date created with formula =today() eg. 26-Sep-2019.
In the same column starting from cell B3 (B3:B600) I have dates and time in format dd.mm.yyyy - hh:mm (example. 20.09.2019 - 21:00).
All those cells (B3:B600) are text cells. In column A there are numbers/index in ascending order.
Somehow I need to find the closest date (B3:B600) to the current date (B3) and to return the corresponding index (column A) into cell C3.
example.
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]26-Sep-2019[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]22.09.2019 - 22:00[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]22.09.2019 - 22:00[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]24.09.2019 - 21:00[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]27.09.2019 - 16:00[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"] 29.09.2019 - 12:45[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
explanation: closest date is 27.09.2019 (cell B6) so index in cell C3 is 4 (A6).
In cell B1 I have current date created with formula =today() eg. 26-Sep-2019.
In the same column starting from cell B3 (B3:B600) I have dates and time in format dd.mm.yyyy - hh:mm (example. 20.09.2019 - 21:00).
All those cells (B3:B600) are text cells. In column A there are numbers/index in ascending order.
Somehow I need to find the closest date (B3:B600) to the current date (B3) and to return the corresponding index (column A) into cell C3.
example.
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]26-Sep-2019[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]22.09.2019 - 22:00[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]22.09.2019 - 22:00[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]24.09.2019 - 21:00[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]27.09.2019 - 16:00[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"] 29.09.2019 - 12:45[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
explanation: closest date is 27.09.2019 (cell B6) so index in cell C3 is 4 (A6).