Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Date Range Formular

Hello all at ExcelBanter,

I have been looking around the Forums for a couple of days now and as yet have been unable to find a solution to a calculation i would like to make.

I have attached a copy of what i have so far. It's not much but i am new to Excel.
I have a set of Seasonal Dates in Column A and B with Nightly prices etc..

In I2 and J2 are Dates that can Input by the user.
What i would like to have is that column F shows up how many nights fall between the season Dates based on the user Input Dates.

So in my example F6 should read as 16 and F7 as 2.
Hopefully that makes sense.
If anyone could give me a couple of hints or direct me to a Tutorial that might help me i would be greatful

Many Thanks
Attached Files
File Type: zip Price calculation.zip (27.1 KB, 90 views)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 259
Default Date Range Formular

Hi

Using your workbook as per your values:

F5 = 70 Nights
F6 = 16 Nights
F7 = 47 Nights.

I don't know where you got 2 from, either way, the formula that you
looking for is this, it will leave the cell blank if there is no date in
Column A.

In Cell F5 type =IF($A5="","",$B5-$A5)

Copy down as required

HTH
Mick.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 259
Default Date Range Formular

On 19/07/2012 1:06 AM, Diverslife wrote:
Hello all at ExcelBanter,

I have been looking around the Forums for a couple of days now and as
yet have been unable to find a solution to a calculation i would like to
make.

I have attached a copy of what i have so far. It's not much but i am new
to Excel.
I have a set of Seasonal Dates in Column A and B with Nightly prices
etc..

In I2 and J2 are Dates that can Input by the user.
What i would like to have is that column F shows up how many nights fall
between the season Dates based on the user Input Dates.



Just thought I would have a second read through to make sure I got what
it is you were looking for and I noticed you already have the
subtraction formula as you stated in your 3rd paragraph.

With this in mind, if what I have posted is not what you want, then
please post back with more specific details, from where I'm at, you
already have the answer to your question in K2.

Cheers
Mick.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Date Range Formular

Hi,

Am Wed, 18 Jul 2012 15:06:33 +0000 schrieb Diverslife:

In I2 and J2 are Dates that can Input by the user.
What i would like to have is that column F shows up how many nights fall
between the season Dates based on the user Input Dates.


in F5 try:
=IF(B5<$I$2,0,IF(AND(A5<$I$2,B5<$J$2),B5-$I$2,IF(AND(A5$I$2,B5$J$2),$J$2-A5,0)))
and drag down


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Date Range Formular

Hi,

Am Thu, 19 Jul 2012 12:50:58 +0200 schrieb Claus Busch:

in F5 try:
=IF(B5<$I$2,0,IF(AND(A5<$I$2,B5<$J$2),B5-$I$2,IF(AND(A5$I$2,B5$J$2),$J$2-A5,0)))
and drag down


I forgot the special condition that all days fall into the season.
Try in F5:
=MAX((A5<$I$2)*(B5<$J$2)*(B5-$I$2),(A5=$I$2)*(B5<=$J$2)*(B5-A5),(A5$I$2)*(B5$J$2)*($J$2-A5))


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,045
Default Date Range Formular

On Wed, 18 Jul 2012 15:06:33 +0000, Diverslife wrote:


Hello all at ExcelBanter,

I have been looking around the Forums for a couple of days now and as
yet have been unable to find a solution to a calculation i would like to
make.

I have attached a copy of what i have so far. It's not much but i am new
to Excel.
I have a set of Seasonal Dates in Column A and B with Nightly prices
etc..

In I2 and J2 are Dates that can Input by the user.
What i would like to have is that column F shows up how many nights fall
between the season Dates based on the user Input Dates.

So in my example F6 should read as 16 and F7 as 2.
Hopefully that makes sense.
If anyone could give me a couple of hints or direct me to a Tutorial
that might help me i would be greatful

Many Thanks


+-------------------------------------------------------------------+
|Filename: Price calculation.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=473|
+-------------------------------------------------------------------+


It appears these are check in and check out days, and that you are counting the First Day, but are NOT counting the LAST day.
Given that, the following appears to work:

F5:
=MAX(0,SUMPRODUCT((ROW(INDIRECT(A5&":"&B5))=$I$2) *
(ROW(INDIRECT(A5&":"&B5))<=$J$2))-($J$2<=B5))

and fill down as far as required.

If you do want to count the last day (in which case F7=3), then simplify the above to:

=SUMPRODUCT((ROW(INDIRECT(A5&":"&B5))=$I$2)*
(ROW(INDIRECT(A5&":"&B5))<=$J$2))

This formula will fail in Excel 2007 or later after 25 November 4770.
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
copy date based on date -refer to date range mindpeace[_4_] Excel Programming 1 June 3rd 06 01:30 PM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Discussion (Misc queries) 1 April 20th 06 10:03 PM
Date conversion formular EH003268 Excel Worksheet Functions 8 March 23rd 06 09:57 PM
any formular to deduct an amount automatically on a given date? Arif Excel Discussion (Misc queries) 1 January 15th 06 05:32 PM
formular to change data on a certain date every month the keyholder Excel Programming 0 December 29th 04 07:27 AM


All times are GMT +1. The time now is 06:31 PM.

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

About Us

"It's about Microsoft Excel"