Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
LGG
 
Posts: n/a
Default Calculate Days in a Month

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   Report Post  
Posted to microsoft.public.excel.misc
Biff
 
Posts: n/a
Default Calculate Days in a Month

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   Report Post  
Posted to microsoft.public.excel.misc
paulrm906
 
Posts: n/a
Default Calculate Days in a Month


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   Report Post  
Posted to microsoft.public.excel.misc
Arvi Laanemets
 
Posts: n/a
Default Calculate Days in a Month

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   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld
 
Posts: n/a
Default Calculate Days in a Month

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   Report Post  
Posted to microsoft.public.excel.misc
TomHinkle
 
Posts: n/a
Default Calculate Days in a Month

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   Report Post  
Posted to microsoft.public.excel.misc
LGG
 
Posts: n/a
Default Calculate Days in a Month

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want the PMT function to calculate using 360 days not 365 amalecki Excel Worksheet Functions 6 April 30th 23 11:44 AM
4 and 5 week months Big Rick Excel Discussion (Misc queries) 15 November 7th 05 12:32 AM
HELP with this function Jay Excel Worksheet Functions 7 May 24th 05 06:45 PM
how do I calculate the days between dates? stucklady! Excel Discussion (Misc queries) 7 February 12th 05 04:39 PM
HOW TO CALCULATE THE DAYS? Bel Excel Worksheet Functions 2 February 2nd 05 07:05 PM


All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"