Days between dates: Difference between revisions

→‎LAMBDA Excel: Added a non-lambda variation of the same formula
(→‎{{header|Excel}}: Added an Excel example (using a LAMBDA expression to map over an array of dates))
(→‎LAMBDA Excel: Added a non-lambda variation of the same formula)
Line 744:
|||style="text-align:right; font-family:serif; font-style:italic; font-size:120%;"|fx
! colspan="4" style="text-align:left; vertical-align: bottom; font-family:Arial, Helvetica, sans-serif !important;"|=LAMBDA(dateString, TODAY() - DATEVALUE(dateString) )(C2#)
|- style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff;"
|
| A
| B
| C
| D
|-
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 1
|
| style="font-weight:bold" | Difference in days
| style="font-weight:bold" | Earlier date
| style="font-weight:bold" | Today
|-
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 2
|
| style="text-align:right; background-color:#cbcefb" | 39020
| 1914-07-28
| style="text-align:right" | 2021-05-27
|-
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 3
|
| style="text-align:right" | 37088
| 1919-11-11
|
|-
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 4
|
| style="text-align:right" | 29916
| 1939-07-01
|
|-
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 5
|
| style="text-align:right" | 27661
| 1945-09-02
|
|}
 
Alternatively, we can express the same mapping by directly writing:
{| class="wikitable"
|-
|||style="text-align:right; font-family:serif; font-style:italic; font-size:120%;"|fx
! colspan="4" style="text-align:left; vertical-align: bottom; font-family:Arial, Helvetica, sans-serif !important;"|= TODAY() - DATEVALUE(C2#)
|- style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff;"
|
9,655

edits