I’m looking for a formula to provide me with a count of the number of months that meet certain criteria.
Here is an example of the cells that would need to be evaluated:
| Months |
|---|
| 2024 May, 2023 October, 2023 August, 2022 December, 2022 October |
| 2024 February, 2023 August, 2023 May, 2022 December, 2022 October |
| 2023 October, 2023 August, 2023 May, 2023 January, 2022 October |
| 2024 May, 2024 March, 2024 February, 2023 January, 2022 October |
| 2024 March, 2024 February, 2023 December, 2023 October, 2023 May |
| 2023 October, 2023 August, 2023 June, 2023 May, 2022 October |
| 2024 May, 2023 October, 2023 May, 2023 March, 2023 January |
| 2023 August, 2023 May, 2023 January, 2022 October |
The user will be selecting a month from a drop down. Let’s say they select 2023 October. I will need the formula to count any cell that contains that month or newer. Result should look like this:
| Months | Count |
|---|---|
| 2024 May, 2023 October, 2023 August, 2022 December, 2022 October | 2 |
| 2024 February, 2023 August, 2023 May, 2022 December, 2022 October | 1 |
| 2023 October, 2023 August, 2023 May, 2023 January, 2022 October | 1 |
| 2024 May, 2024 March, 2024 February, 2023 January, 2022 October | 3 |
| 2024 March, 2024 February, 2023 December, 2023 October, 2023 May | 4 |
| 2023 October, 2023 August, 2023 June, 2023 May, 2022 October | 1 |
| 2024 May, 2023 October, 2023 May, 2023 March, 2023 January | 2 |
| 2023 August, 2023 May, 2023 January, 2022 October | 0 |
Other Notes:
- The months will always been in order (Recent to Oldest)
- Format of months will always be 4-Digit Year, Full Month Name
- Location of user selected month: Let’s say Settings!A1
- Location of cells to be evaluated: Data!A2:A
- Location of cells with counts: Data!B2:B
>Solution :
Here’s one approach you may test out:
=map(A2:A,lambda(Σ,if(Σ="",,let(Λ,split(Σ,", ",),countif(Λ,">="&A1)))))
- Adjust ranges in the formula as needed in your sheet
