Find the last Sunday of each month: Difference between revisions
Content added Content deleted
No edit summary |
(→{{header|Excel}}: Added a draft for Excel LAMBDA) |
||
Line 1,412: | Line 1,412: | ||
2013-12-29 |
2013-12-29 |
||
</pre> |
</pre> |
||
=={{header|Excel}}== |
|||
===LAMBDA=== |
|||
Binding the name '''lastSundayOfEachMonth''' to the following lambda expression in the Name Manager of the Excel WorkBook: |
|||
(See [https://www.microsoft.com/en-us/research/blog/lambda-the-ultimatae-excel-worksheet-function/ LAMBDA: The ultimate Excel worksheet function]) |
|||
{{Works with|Office 365 betas 2021}} |
|||
<lang lisp>lastSundayOfEachMonth |
|||
=LAMBDA(y, |
|||
LAMBDA(monthEnd, |
|||
1 + monthEnd - WEEKDAY(monthEnd) |
|||
)( |
|||
EDATE( |
|||
DATEVALUE(y & "-01-31"), |
|||
SEQUENCE(12, 1, 0, 1) |
|||
) |
|||
) |
|||
)</lang> |
|||
{{Out}} |
|||
The formula in cell B2 defines an array which populates the range '''B2:B13''' |
|||
{| class="wikitable" |
|||
|- |
|||
|||style="text-align:right; font-family:serif; font-style:italic; font-size:120%;"|fx |
|||
! colspan="2" style="text-align:left; vertical-align: bottom; font-family:Arial, Helvetica, sans-serif !important;"|=lastSundayOfEachMonth(A2) |
|||
|- style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff;" |
|||
| |
|||
| A |
|||
| B |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 1 |
|||
| style="font-weight:bold" | Year |
|||
| |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 2 |
|||
| 2013 |
|||
| style="background-color:#cbcefb" | 2013-01-27 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 3 |
|||
| |
|||
| 2013-02-24 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 4 |
|||
| |
|||
| 2013-03-31 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 5 |
|||
| |
|||
| 2013-04-27 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 6 |
|||
| |
|||
| 2013-05-25 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 7 |
|||
| |
|||
| 2013-06-29 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 8 |
|||
| |
|||
| 2013-07-27 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 9 |
|||
| |
|||
| 2013-08-24 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 10 |
|||
| |
|||
| 2013-09-28 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 11 |
|||
| |
|||
| 2013-10-26 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 12 |
|||
| |
|||
| 2013-11-24 |
|||
|- |
|||
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 13 |
|||
| |
|||
| 2013-12-29 |
|||
|} |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |