# SumIF and CountIF with dates

#### sarahjane2019

##### New Member
Hi
I have dataset of customers who purchase plans each month. This data has approx.75,000 lines. This list consists of: customer, amount, month. I have created a pivot table with the following:

• Rows: customers
• Values: amount
• Columns: month (15 months)
What I am trying to find out is the number of customers who are lost each month and the number of customers that are gained each month as well as the revenue gained and lost figures. I need to know the month they first purchased a plan, and the last plan they purchased. I have used SUMIFs and COUNTIFs however the numbers don't add up. What formulas would you use to work this out?

### Excel Facts

Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

#### Panda514

##### New Member
Hello, you could use a vlookup to see who the returning customers are. For example, I would copy/paste the February 2019 customers onto a new tab and remove duplicate customers names/ID's then vlookup the February 2019 customers to the list of all your previous employees. This will tell you who the returning customers and who the new customers are in February 2019.

If you need to know the month they first purchased a plan then add a column for earliest and oldest. You will have to reference the tab that has all of the customer data.

For earliest, use =IF(MIN(IF(range of all customers on the full list="first cell of customer on Feb list",range of dates on the full list))=0,"")
For oldest, use the same formula as above, but change MIN to MAX.

I hope this helps! Someone may be able to come up with a much simpler way, but I saw that you had no replies and wanted to help.

Replies
2
Views
412
Replies
2
Views
84
Replies
5
Views
236
Replies
3
Views
214
Replies
8
Views
603

1,129,714
Messages
5,637,940
Members
416,993
Latest member
ant8989

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back