How do I write the formula if I want to calculate "length of stay", say hotel
check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer is
easy, 10-1=9 days, but when it involves dates, how do you put it in a formula?
How do I write the formula if I want to calculate "length of stay", say hotel
check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer is
easy, 10-1=9 days, but when it involves dates, how do you put it in a formula?
Assuming:
Check-in dates are in col A, A2 down
Check-out dates are in col B, B2 down
and
Length of stay is to be calculated in col C, C2 down
Put in C2: =B2-A2
Format C2 as "General" or "Number" (to zero dp)
Copy C2 down
Col C will return the results you want
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <at>yahoo<dot>com
----
"pumper" <pumper@discussions.microsoft.com> wrote in message
news:2E779EE7-CBEC-4FF0-8620-D200F45677F7@microsoft.com...
> How do I write the formula if I want to calculate "length of stay", say
hotel
> check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer
is
> easy, 10-1=9 days, but when it involves dates, how do you put it in a
formula?
On Sun, 16 Jan 2005 17:59:04 -0800, pumper <pumper@discussions.microsoft.com>
wrote:
>How do I write the formula if I want to calculate "length of stay", say hotel
>check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer is
>easy, 10-1=9 days, but when it involves dates, how do you put it in a formula?
If the check in date is in A1, and the check out date in A2, then =A2-A1 and
format the result as General.
--ron
Max,
Thank you for the quick response. The mistake I did was I had C2 formated
as "date" instead of "General". Now it works!
Thanks,
pumper
"Max" wrote:
> Assuming:
>
> Check-in dates are in col A, A2 down
> Check-out dates are in col B, B2 down
>
> and
>
> Length of stay is to be calculated in col C, C2 down
>
> Put in C2: =B2-A2
> Format C2 as "General" or "Number" (to zero dp)
> Copy C2 down
>
> Col C will return the results you want
>
> --
> Rgds
> Max
> xl 97
> ---
> GMT+8, 1° 22' N 103° 45' E
> xdemechanik <at>yahoo<dot>com
> ----
> "pumper" <pumper@discussions.microsoft.com> wrote in message
> news:2E779EE7-CBEC-4FF0-8620-D200F45677F7@microsoft.com...
> > How do I write the formula if I want to calculate "length of stay", say
> hotel
> > check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer
> is
> > easy, 10-1=9 days, but when it involves dates, how do you put it in a
> formula?
>
>
>
Ron,
I didn't format my result as "General", that's why I kept getting weird
results. I got it now. Thank you.
pumper
"Ron Rosenfeld" wrote:
> On Sun, 16 Jan 2005 17:59:04 -0800, pumper <pumper@discussions.microsoft.com>
> wrote:
>
> >How do I write the formula if I want to calculate "length of stay", say hotel
> >check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer is
> >easy, 10-1=9 days, but when it involves dates, how do you put it in a formula?
>
> If the check in date is in A1, and the check out date in A2, then =A2-A1 and
> format the result as General.
>
>
> --ron
>
You're welcome !
Thanks for posting back
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <at>yahoo<dot>com
----
"pumper" <pumper@discussions.microsoft.com> wrote in message
news:B8675FC6-70F6-49B7-BE41-758287BCC6F8@microsoft.com...
> Max,
> Thank you for the quick response. The mistake I did was I had C2 formated
> as "date" instead of "General". Now it works!
>
> Thanks,
>
> pumper
Max,
One more question...if I want Column C, i.e., C3 downward all the way (all
the way down, say I have a long spreadsheet) to have the same formula as in
cell reference C2, how do I do that?
pumper
"Max" wrote:
> Assuming:
>
> Check-in dates are in col A, A2 down
> Check-out dates are in col B, B2 down
>
> and
>
> Length of stay is to be calculated in col C, C2 down
>
> Put in C2: =B2-A2
> Format C2 as "General" or "Number" (to zero dp)
> Copy C2 down
>
> Col C will return the results you want
>
> --
> Rgds
> Max
> xl 97
> ---
> GMT+8, 1° 22' N 103° 45' E
> xdemechanik <at>yahoo<dot>com
> ----
> "pumper" <pumper@discussions.microsoft.com> wrote in message
> news:2E779EE7-CBEC-4FF0-8620-D200F45677F7@microsoft.com...
> > How do I write the formula if I want to calculate "length of stay", say
> hotel
> > check-in date was 1/1/2005 and check-out date was 1/10/2005? The answer
> is
> > easy, 10-1=9 days, but when it involves dates, how do you put it in a
> formula?
>
>
>
"pumper" <pumper@discussions.microsoft.com> wrote
> One more question...if I want Column C, i.e., C3 downward all the way (all
> the way down, say I have a long spreadsheet) to have the same formula as
in
> cell reference C2, how do I do that
Just copy C2 down
Point the cursor at the bottom right corner of C2
(the cursor will change to a "black cross")
Now just left-click and drag down to copy C2 to C3, C4 ... C200 etc
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <at>yahoo<dot>com
----
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks