# Excel/Pivot Tables

Question
PIVOT TABLES - I AM USING EXCEL 2010

My first question is concerning the calculation of days between dates
How do I do the following;

This is real estate and I want to know how many days the house has been on the market while under contract with the real estate agent.

The column '' Days on the market' will have the formula for the calculation. The thing is what would be the formula that would consider the days on the market for a house that did not sell (date expired) I want to enter the date in the first 3 columns and have the total day in the fourth column even the one that did not sell. So what formula do I need to use so it calculates the number of days on the market if there is data in the column DATE SOLD and when the cell is empty and still take into consideration when there is data in the column DATE EXPIRED (meaning the house did not sell and agents contract has expired)

DATE LISTED  DATE SOLD    DATE EXPIRED   DAYS ON THE MARKET
2014-03-01   2014-06-16
2014-03-11          14-09-2014
12-06-2015   2015-08-22

The second question iS; I want to calculate the difference between the asking and the sold price and column 3 would have the formula BUT the house where the asking price is \$ 5000,000.00 did not sell so the calculation in the column should return a 0 because the sold price is 0. What formula do I need to use in the 3rd column when the data in sold price is 0

200 000,00 \$   195 000,00 \$     \$ 5,000.00
500 000,00 \$   0,00 \$
220 000,00 \$   200 000,00 \$
205 000,00 \$   201 000,00 \$

it's not totally clear from AllExperts what the question is - or at least, what data you had and what you needed to do.  To get days on the market, it's a simple X-y - where y is the starting date, and X is the date you want to stop calculating (so presumably, if expired is blank, today).  Thus

=if(expired=0,today(),expired)-StartingDate

would give you the essence of the formula - replace my  expired and startingDate with cell references.

The same method would give you the answer to your second part - in both cases, I'd personally have these outside any pivot table (so formulas to the right or left would work)
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Aidan Heritage

##### Expertise

I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!

##### Experience

My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

Education/Credentials
I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!