4
41roblynway
Hi all, I am trying to create a spreadsheet that calculates allowable
(pro-rated) car rental expenses that employees can claim for a
conference that was held. The organization has agreed to pay employee
car rental expenses that fall between the dates of the conference 7th
Sept 2008 and 14th October 2008 (including both of those days).
However, some car rental contracts fall partially in this range, (as
some employees showed up early or stayed late for vacation), and
employees are reimbursed accordingly. I am trying to create a
spreadsheet that gives the number of allowable days (inside the range)
and non-allowable days (number of days outside the range) for each
employee car rental contract. Each row represents one car rental
expense.Cell E8 is the first expense start_date and cell F8 is the
first expense end_date. As I see it, there are 6 possible combinations
to calculate allowable days: (please note the dash is being used as a
subtraction sign in my formulas)
1. Expense START_DATE is before period and END_DATE is also before the
period: NO ALLOWABLE DAYS
2. START_DATE is before period and END_DATE falls within the range:
EXPENSE END_DATE - 7 SEPT 2008
3. START_DATE is before period and END_DATE falls after the period: 14
OCT 2008 - 7 SEPT 2008
4. START_DATE falls within range and END_DATE falls within range:
END_DATE - START_DATE
5. START_DATE falls within range and END_DATE falls after range: 14
OCT 2008 - START_DATE
6. START_DATE is after range and END_DATE is after range: NO ALLOWABLE
DAYS
I started experimenting with formulas at the beginning (below), but
that was before I figured out that there were more possibilities than
I had accounted for.
=IF(D8>0,(IF(E8>=DATEVALUE("7/9/2008"),((+$C$4-E8)+1),IF(E8<DATEVALUE
("7/9/2008"),(F8-$C$3)+1))),"")
Oh, and as you can see, I wanted the cell to be blank if that row had
not been filled out yet.
So, my brain hurts when I try and think about writing this formula for
all 6 possibilities, but I'm guessing there are those of you out there
that are much more skilled than I at this that could do this in their
sleep. If anyone could help, I would greatly appreciate it. Thanks,
Rob
(pro-rated) car rental expenses that employees can claim for a
conference that was held. The organization has agreed to pay employee
car rental expenses that fall between the dates of the conference 7th
Sept 2008 and 14th October 2008 (including both of those days).
However, some car rental contracts fall partially in this range, (as
some employees showed up early or stayed late for vacation), and
employees are reimbursed accordingly. I am trying to create a
spreadsheet that gives the number of allowable days (inside the range)
and non-allowable days (number of days outside the range) for each
employee car rental contract. Each row represents one car rental
expense.Cell E8 is the first expense start_date and cell F8 is the
first expense end_date. As I see it, there are 6 possible combinations
to calculate allowable days: (please note the dash is being used as a
subtraction sign in my formulas)
1. Expense START_DATE is before period and END_DATE is also before the
period: NO ALLOWABLE DAYS
2. START_DATE is before period and END_DATE falls within the range:
EXPENSE END_DATE - 7 SEPT 2008
3. START_DATE is before period and END_DATE falls after the period: 14
OCT 2008 - 7 SEPT 2008
4. START_DATE falls within range and END_DATE falls within range:
END_DATE - START_DATE
5. START_DATE falls within range and END_DATE falls after range: 14
OCT 2008 - START_DATE
6. START_DATE is after range and END_DATE is after range: NO ALLOWABLE
DAYS
I started experimenting with formulas at the beginning (below), but
that was before I figured out that there were more possibilities than
I had accounted for.
=IF(D8>0,(IF(E8>=DATEVALUE("7/9/2008"),((+$C$4-E8)+1),IF(E8<DATEVALUE
("7/9/2008"),(F8-$C$3)+1))),"")
Oh, and as you can see, I wanted the cell to be blank if that row had
not been filled out yet.
So, my brain hurts when I try and think about writing this formula for
all 6 possibilities, but I'm guessing there are those of you out there
that are much more skilled than I at this that could do this in their
sleep. If anyone could help, I would greatly appreciate it. Thanks,
Rob