Having trouble with macros

Closed
pepeioo Posts 1 Registration date Saturday September 22, 2012 Status Member Last seen September 22, 2012 - Sep 22, 2012 at 12:08 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Sep 24, 2012 at 08:54 AM
Hello,

I need you help please, I want to write the macros something like this:

if x = 1(number of month) and y = 1 then
z = 31(number of the days of first month January)

if x = 2 and y = 1 then
z = 29(February)

if x= 1 and y = 2 then
z = 31 + 29 (Jan + Feb)

w8ing for your answer thanks.

<config>Windows XP / Chrome 21.0.1180.89</config>

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Sep 23, 2012 at 07:21 AM
=IF(A1="",0,IF(OR(A1=1,A1=3,A1=5,A1=7,A1=8,A1=10,A1=12),31,IF(OR(A1=4,A1=6,A1=9,A1=11),30,IF(A1=2,29,0)))) + IF(B1="",0,IF(OR(B1=1,B1=3,B1=5,B1=7,B1=8,B1=10,B1=12),31,IF(OR(B1=4,B1=6,B1=9,B1=11),30,IF(B1=2,29,0))))
0
thanks for this formula but it is not exactly the formula which I asked, I mean if A1 = 1 and B1 = 3 then C1 = jan + feb + march, so A1 = the starting month and B1 = the number of months from A1.
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Sep 24, 2012 at 08:54 AM
=DATEDIF(DATE(2000,A1,1),DATE(2000,A1+B1,1),"d") -IF(B1-A1>0,1,0)
0