A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
(if I have understood you well)
For the first request in cell U1 apply this formula:
=VSTACK(A1:S1, FILTER(A2:S20, (YEAR(N2:N20) = 2023) * (YEAR(S2:S20) = 2024)))
or alternatively you can use this formula:
=LET(gb, GROUPBY(HSTACK(A1:.A20, B1:.I20, J1:.J20, Q1:.Q20), IFERROR(HSTACK(N1:.N20, S1:.S20), ""), ARRAYTOTEXT, 3, 0,, IFERROR((YEAR(N2:.N20) = 2023) * (YEAR(S2:.S20) = 2024), 0)), IF(ISNUMBER(--gb), --gb, gb))
For the second request in cell U6 apply this formula:
=VSTACK(A1:S1, FILTER(A2:S20, (YEAR(N2:N20) = 2023) * (S2:S20 = "")))
or alternatively you can use this formula:
=LET(gb, GROUPBY(HSTACK(A1:.A20, B1:.I20, J1:.J20, Q1:.Q20), IFERROR(HSTACK(N1:.N20, S1:.S20), ""), ARRAYTOTEXT, 3, 0,, IFERROR((YEAR(N1:.N20) = 2023) * (S1:.S20 = ""), 1)), IF(ISNUMBER(--gb), --gb, gb))
If you do not want to see columns that do not contain data in the applied formulas, then in these formulas you will need to apply the CHOOSECOLS function and select only those columns that contain data.
Note: Format cells that contain dates as dates and in cases where the cells do not contain dates, format these cells as General.