# Excel/IF + COUNTIF?

Question
Hi Richard,
In sheet DATA I have a list of deals sold to clients.
Each deal is a row.
In column A there is the week number in the year.
In column B there is the revenues for the deal.
In column C states whether the client is new (1) or old (2).

In sheet COMPARISON I have a row for each week -
in column A I wish to count all the new deals for each week
in column B I wish to count all the old deals for each week
in column C I wish to sum all the deals for each week.

Pivot table is not aloud.
Thanks

Moshe

I would solve this by using a sumifs formula which will allow you to sum based on the meeting of multiple criteria.  Your criteria are--- 1 does it meet a certain week, and 2 is it old or new.

First we need to have a column in your comparison sheet for week number I have based my formula on that being in column A

The formula in the comparison sheet column B row 2 which is the "new" column would be
=SUMIFS(DATA!\$C\$2:\$C\$100,DATA!\$A\$2:\$A\$100,\$A2,DATA!\$C\$2:\$C\$100,1)

The formula in column c which is the "old" column would be
=SUMIFS(DATA!\$C\$2:\$C\$100,DATA!\$A\$2:\$A\$100,\$A2,DATA!\$C\$2:\$C\$100,2)/2

As you can see many of the references are made absolute so that you may copy down and across and they will maintain there reference.  Since the number two is used to indicate old, then the second formula needs to divide the sum of the old sales by 2 to get the correct number.

As you will recognize, we didn't use the count formula because a sum of the criteria, (1 for new) and (2 for old divided by 2) would give the same result as counting.

If you create a new column in your comparison sheet and make it the week number column, you should be able to copy the formulas as they are written here.

Hope this helps

Richard
Florida
USA
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

#### Richard Roberts

##### Expertise

Can assist you in most areas of Excel, have been working with it for about 15 years in many types of applications, but primarily in financial and accounting applications. I am a CPA and many client or client problems have necessitated the use of excel. I am not an expert in charting, macros, or pivot tables.

##### Experience

Have been working with Excel for about 20 years primarily in accounting and financial areas.

Education/Credentials
BA, Certified Public Accountant