Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi. I need help finding a formula to calculate the number of days in a month
depending on the month you choose from a drop down menu. Example: In cell A1 user will be ask to select a month from a drop down menu. In cell B1 I want the number of days in the month corresponding to the month selected in A1. So, if February is chosen on A1, then 28 (days) would appear on B1. I was trying to do if statements, but I keep getting an error. Is there an easy way to do this? Thanks LGG |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi!
if February is chosen on A1, then 28 (days) would appear What about leap years when Feb has 29 days? One way: In some location list the months: J1 = January J2 = February J3 = March ... J12 = December =DAY(DATE(YEAR(TODAY()),MATCH(A1,J1:J12,0)+1,0)) Biff "LGG" wrote in message ... Hi. I need help finding a formula to calculate the number of days in a month depending on the month you choose from a drop down menu. Example: In cell A1 user will be ask to select a month from a drop down menu. In cell B1 I want the number of days in the month corresponding to the month selected in A1. So, if February is chosen on A1, then 28 (days) would appear on B1. I was trying to do if statements, but I keep getting an error. Is there an easy way to do this? Thanks LGG |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hello LGG Well the easist way that I know to count the days in a month =DAY(EOMONTH($A$1;0)) but as for the Leap Year I am not 100% sure. I hope this is of help to you. Paul Maynard -- paulrm906 ------------------------------------------------------------------------ paulrm906's Profile: http://www.excelforum.com/member.php...o&userid=28776 View this thread: http://www.excelforum.com/showthread...hreadid=500997 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi
Add a sheet Months. Months!A1="Month" Months!A2=01.01.2006 (or any other 1st of month in any valid date format) Months!A3=01.02.2006 Select the range Months!A2:A3, and format in some valid date format like "mmmm yyyy" or "yyyy.mmmm". Copy the range down for some reasonable amount of rows - you get a list of months to be selected. Select the list of months, and define it as a named range Months. Hide sheet Months. On your entry sheet, apply to some cell (p.e. B1) a data validation list with Source=Months, and format the cell like month list on sheet Months. Into another cell, enter the formula: =IF($B$="","",DAY(DATE(YEAR($B$1),MONTH($B$1)+1,0) )) ,or, with Analysis Toolpack Ad-In activated =IF($B$="","",DAY(EOMONTH($B$1,0))) -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) "LGG" wrote in message ... Hi. I need help finding a formula to calculate the number of days in a month depending on the month you choose from a drop down menu. Example: In cell A1 user will be ask to select a month from a drop down menu. In cell B1 I want the number of days in the month corresponding to the month selected in A1. So, if February is chosen on A1, then 28 (days) would appear on B1. I was trying to do if statements, but I keep getting an error. Is there an easy way to do this? Thanks LGG |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Thu, 12 Jan 2006 22:30:02 -0800, LGG wrote:
Hi. I need help finding a formula to calculate the number of days in a month depending on the month you choose from a drop down menu. Example: In cell A1 user will be ask to select a month from a drop down menu. In cell B1 I want the number of days in the month corresponding to the month selected in A1. So, if February is chosen on A1, then 28 (days) would appear on B1. I was trying to do if statements, but I keep getting an error. Is there an easy way to do this? Thanks LGG To check the days of the month, I assumed that 1. The month you are choosing is from a list of text strings, and not real Excel dates formatted to show just the month. 2. The year is "this" year, so February will only show 29 days if "this" year is a leap year. B1: =DAY((A1&YEAR(TODAY()))+32-DAY((A1&YEAR(TODAY()))+32)) --ron |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Easy.... One line....
ASSUMING the value in A1 is a date in B1: =Date(year(a1),month(a1)+1,1))- Date(year(a1),month(a1),1)) "LGG" wrote: Hi. I need help finding a formula to calculate the number of days in a month depending on the month you choose from a drop down menu. Example: In cell A1 user will be ask to select a month from a drop down menu. In cell B1 I want the number of days in the month corresponding to the month selected in A1. So, if February is chosen on A1, then 28 (days) would appear on B1. I was trying to do if statements, but I keep getting an error. Is there an easy way to do this? Thanks LGG |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Biff! This was really helpful. It works!!! You saved my work.
LGG "Biff" wrote: Hi! if February is chosen on A1, then 28 (days) would appear What about leap years when Feb has 29 days? One way: In some location list the months: J1 = January J2 = February J3 = March ... J12 = December =DAY(DATE(YEAR(TODAY()),MATCH(A1,J1:J12,0)+1,0)) Biff "LGG" wrote in message ... Hi. I need help finding a formula to calculate the number of days in a month depending on the month you choose from a drop down menu. Example: In cell A1 user will be ask to select a month from a drop down menu. In cell B1 I want the number of days in the month corresponding to the month selected in A1. So, if February is chosen on A1, then 28 (days) would appear on B1. I was trying to do if statements, but I keep getting an error. Is there an easy way to do this? Thanks LGG |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I want the PMT function to calculate using 360 days not 365 | Excel Worksheet Functions | |||
4 and 5 week months | Excel Discussion (Misc queries) | |||
HELP with this function | Excel Worksheet Functions | |||
how do I calculate the days between dates? | Excel Discussion (Misc queries) | |||
HOW TO CALCULATE THE DAYS? | Excel Worksheet Functions |