I have a drop down list in cell F1 with all the months. In G1, I would like it to automatically display the number of days in the selected month. Of course it depends on the current year (due to leap year, etc).
Thank you in advance!
Nick
I have a drop down list in cell F1 with all the months. In G1, I would like it to automatically display the number of days in the selected month. Of course it depends on the current year (due to leap year, etc).
Thank you in advance!
Nick
Are your months in Text or Date format?
If you are happy with the results, please add to the contributor's
reputation by clicking the reputation icon (star icon).
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
Select Thread Tools-> Mark thread as Solved.
To undo, select Thread Tools-> Mark thread as Unsolved.
http://www.excelaris.co.uk
Text, January, February, etc
Thank you.
one way with text months jan/feb or january,february...........=EOMONTH(VALUE("1/"&F1&YEAR(TODAY())),0) format cell as custom dd
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and now happily retired
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Slightly quicker
=EOMONTH(--("1/"&F1&YEAR(TODAY())),0)
Here's another one...
=DAY(EOMONTH("1/"&F1&YEAR(NOW()),0))
Format as General or Number
Biff
Microsoft MVP Excel
Keep It Simple Stupid
Let's Go Pens. We Want The Cup.
Thank you for all the replies… Now…
Is it possible now to protect just that one cell with the formula in it so somebody doesn't accidentally change it who doesn't know better?
I went to protect worksheet in the Tools menu, but then when I chance the month in the drop down list, it says the sheet is protected and it won't change the value.
Thanks again.
Nevermind, I got it .. it was still "Locked".
Good deal. Thanks for the feedback!
Tony.. done!
Okay, so now that I formatted that as "dd", I cannot reference that cell in the formula for another cell because it uses the value "41,350" or something instead of 31 … Any ideas how to change that?
Thanks.
=DAY(EOMONTH("1/"&F1&YEAR(NOW()),0)) which tony suggested
I think we don't need YEAR(TODAY()) here. If we omit that excel will consider that is from current year.
=DAY(EOMONTH(1&F1,0))
Regards,
Haseeb Avarakkan
__________________________________
"Feedback is the breakfast of champions"
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks