referencing date so you can use A value or B value in a formula

V

v1rt8

two date ranges (may 1 thru oct 31)(nov 1 thur apr 30). depending on the date
there is a different value giving. example, its sept 8 and the value i need
is 184.
If it was dec 25, the value i would need is 189. all of this needs to
reference the date which i used in a different cell using =(today)).
any help would be appreciated.
 
V

v1rt8

Sheelo, thank you for the interest.
Based on the date in cell H1 that has the formula =today(),
cell H2 is where i need a formula for the following:
Date ranges are from (May 1 - Oct 31) if cell H1 falls between these dates
then the result in cell H2 displays 184. however if the date in cell H1 is
between (Nov 1 - Apr 30) then the result in cell H2 displays 189. is there
also something else i would need to change the cell H1 as far as formating.
the numbers displayed are used later on in the spreadsheet.
 
J

JLatham

Look at the problem in a slightly different way: If the current month is >4
and it is <11 then it must be in May-October. If it isn't >4 and <11, then
it must be in the Nov-Apr time frame.
So we could put this in H2:
=IF(AND(MONTH(H1)>4,MONTH(H1)<11),184,189)
or even as
=IF(AND(MONTH(NOW())>4,MONTH(NOW())<11),184,189)

Hope this helps.
 
V

v1rt8

I used the second suggestion and it worked perfectly. validated by changing
system time. I appreciate your quick and accurate reply thanks
 
S

Sheeloo

Enter the following in A1 to A4;
30-May-2008
31-Oct-2008
1-Nov-2008
1-May-2009

Enter this in H2
=IF(AND(H1>A1,H1<A3),184,IF(AND(H1>A2,H1<A4),189,"Not in range"))

This will give you what you want in H2 by entering the date in H1.

btw JLatham's solution is better than this but this might come handy in
future.
 
V

v1rt8

Thank you also sheelo, it will come in handy

Sheeloo said:
Enter the following in A1 to A4;
30-May-2008
31-Oct-2008
1-Nov-2008
1-May-2009

Enter this in H2
=IF(AND(H1>A1,H1<A3),184,IF(AND(H1>A2,H1<A4),189,"Not in range"))

This will give you what you want in H2 by entering the date in H1.

btw JLatham's solution is better than this but this might come handy in
future.
 
J

JLatham

The formula I provided was specific to the request - and it is pretty much
limited to dividing the year into 2 parts. Yours is more 'generic' and
adaptable to more situations and is also extensible to deal with more than
just 2 possible conditions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top