0

Is there a possibility to have a drop down with months inside, when choosing one month to show me all instances that are within that month?

Something similar has Excel format Tables, when you choose filter, and month, but I dont neet that solution but only in drop down...

This is like basic Date column, with all date instances...

Date

This is Excel format Table filter: I know it can be "tick" on month and things are easy but my background is different, as you see on first picture there like blocks or rows, it is with purpose, 10 rows per one block, and there can be more date instances. So this table filter will work only for matches but I wanna that my 10 rows remain even though they might be empty....

Excel table

How to achieve that solution in drop down to have just corresponding month, and when I choose it it should show me all instances within that month...I wanna have formulas..

0

1 Answer 1

1

On a new sheet, pick a cell such as A1 and type in the date of the 1st of the first month that you need to use, eg 1/1/2001.

Under that, type in the 1st of the next month eg 1/2/2001 Select both cells and drag the cell handle down to create a list of months for as long as you need. Select all those months and apply a custom format such as as "mmm yy" to get "Jan 01". With those months selected, in the name box type a new name to refer to this list by such as "MonthsList".

On your original sheet, choose where you want to pick the month, and apply data validation to that cell, using =MonthsList as the source. You now have a picklist to choose the month. Apply a suitable number format to this too.

Select this cell and give that a name too, maybe "SelectedMonth"

Back on your new sheet, in a new column, maybe at C1, enter this formula:

=SelectedMonth

in the cell beneath that, C2, enter this:

=IF(C1+1=DATE(YEAR(SelectedMonth),MONTH(SelectedMonth)+1,1),"",C1+1)

That checks what would happen if you add 1 to the date above - is it equal to the first day of the month after the selected month (that's why the +1 in the middle). Format both C1 and C2 as dates. Drag this down 30 rows to row 31. Now select C1:C31 and give that a name such as DatesList. Back on your original sheet, under the cell where you select a month, apply data validation and use =DatesList as the source.

Job done. For months with <31 days you will have some blank rows at the end of the second picklist. You could tidy this up using a formula for DatesList instead of just cell references, then you can use OFFSET or INDEX techniques to return only as many rows as have data in them. But realistically I would probably not worry about that for this use case where it should be obvious not to choose them.

In the end you now have a date selected which you can use in formulas or whatever to do comparisons, filtering etc.

2
  • I will check it and give a response! thanks
    – MmVv
    Commented Apr 27, 2021 at 14:11
  • 1
    Thanks, this thing will work and the principle is very useful for my further calculations. Always something new to learn!
    – MmVv
    Commented Apr 29, 2021 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .