do sum filtered by year - excel

Hi want to create some report using data what I have. Below is what I have.
Date Sold
22-Oct-11 22
23-Oct-11 28
24-Oct-11 10
22-Oct-12 22
23-Oct-12 28
24-Oct-12 10
What I want is create year and sold total as below.
Year Sold
2011 60
2012 87
Any idea how to get this done using excel pre-defined function.
I know this can be done using MACRO, however I don't want to use MACRO.
Edit 1
I don't want to do this using Pivot too. ONLY Excel pre-defined functions.

It's possible to use an array formula (Ctrl-Shift-Enter in formula window to enter, the curled brackets will be inserted by Excel, not by user):
={SUM(IF(YEAR(A1:A4)=2010,1,0)*B1:B4)}
Dates are in column A, sold quantities in column B.

Try this formula: =SUMIF($A$2:$A$7;"=*11";$B$2:$B$7).
I think it's possible to improve this formula, but I'm just a beginner.

If you can add an extra column for =Year(date) then you can use Subtotals to calculate your results (Data-Subtotals)

you can use a pivot table. put the date field on the left, right click and Group by year and put the sold field in the values area

With Excel 2007 (and later), you have access to the SUMIFS function
Assuming your data is in columns A and B, in the order shown, then a function to add up all the data in 2011 would be
=SUMIFS(B:B,A:A,">="&DATE(2011,1,1),A:A,"<="&DATE(2011,12,31))
of course, you can reference a cell containing the year number in place of the 2011 to make it portable

Related

Is there a way to make excel expand dates in a spreadsheet

I have a large two column data set that already has dates and data, whoever I need the dates to "expand" for daily data
I already attempted to auto-fill however it doesn't do what I need it to
I have a spreadsheet like this
date Data
07/01/19 5
07/03/19 10
09/05/19 7
I'd like to expand the dataset like
date Data
07/01/19 5
07/02/19
09/03/19 10
07/04/19
07/05/19 7
Create another sheet with all of the dates that you need in column A. Then use this formula to look up your Data (column B) against these dates:
=IFERROR(VLOOKUP(A1,Sheet2!A:B,2,0),"")
It will match the desired output you have posted above.
With your data in columns A:B, you can use the following formulas:
D2: =IFERROR(INDEX(ROW(INDEX($A:$A,MIN($A:$A),1):INDEX($A:$A,MAX($A:$A),1)),ROWS($1:1)),"")
E2: =IFERROR(VLOOKUP(D2,$A:$B,2,FALSE),"")
and fill down
note that this formula will fail after 25 Nov 4770, but you'll probably be using a different tool by then :-)

how to count unique values by certain criteria?

Say if I had the following sample table:
Country Year
USA 2010
USA 2010
USA 2010
Australia 2011
India 2010
China 2010
Output should be:
2010: 3 (USA, India, and China)
2011: 1 (Australia)
2012: 0 ()
I am trying to count the unique number of countries during a certain year.
I having trouble how to get the nested conditional count working.
Any help would be greatly appreciated.
I cannot use VBA, i must use native excel functions or pivot tables.
Copy and paste your data into a new worksheet to allow you to play with it.
Remove Duplicates (Data>Data Tools>Remove Duplicates) based on country and year.
Then sort ascending with filter based on year (Data>Sort & Filter).
Then subtotal a count (Data>Outline>Subtotal) based on change in year.
I think you can get some way there by concatenating Year&Country and then do a count within a pivottable. The only problem is that you can't get a zero. This also won't lay it out in the way it looks like you want but is that important?
If so, then a formula might help which would list unique entries in a range (again utilising the concatenated column)......
I have developed a formula which does this using countif:
Hope this help you or someone else need to list and count unique values.
Just adding a link to share the excel file I've created. Enjoy. Excel file

excel 2010 Count IF value and date meet condition

Hi look at some topics here could not find one that meets what I need to do.
I have a SharePoint list which I open in Excel(2010) in SharePoint I have created a calculated field that counts how days have passed between to dates. in excel these columns are "M" and "N". My calculated column in excel is "T"
This made the calculation in excel simple.
which calculate how many days have passed that is less than 6 (days).
=COUNTIF(Data!$T:$T,"<"& 6)
This give me overall calculation for 12 months. What I need to do is break it down per months.
for example: how many days pass that is less than 6 in Nov. my date column "M" so I tried
=COUNTIF(Data!$T:$T,"<"&6&"AND"& TEXT(Data!$M:$M,"mmm") = "Nov")
This give me a count of zero which I know is not correct. so I was wondering what the best way to add the second columns criteria ?
Try this
=SUMPRODUCT((TEXT(Data!$M:$M,"mmm")="Nov")*(Data!$T:$T<6))
As you have Excel 2010, you can use the more powerful COUNTIFS
=COUNTIFS(Data!$T:$T,"<6",Data!$M:$M,">="&DATE(2013,11,1),Data!$M:$M,"<"&DATE(2013,12,1))
The DATE calculation can also reference cells, so you could change the count to this: (split into lines for readability)
=COUNTIFS(Data!$T:$T,"<6",
Data!$M:$M,">="&DATE(2013,MonthCell,1),
Data!$M:$M,"<"&DATE(2013,MonthCell+1,1))

Summarise data based on date

I have a set of data in excel that looks like this:
Project Name alpha date alpha price beta date beta price final date final price
Project a 1/01/2013 $123.00 2/02/2013 $324.00 5/02/2013 $222.00
Project b 2/01/2013 $432.00 9/03/2013 $111.00 30/03/2013 $321.00
project c 2/02/2013 $4,431.00 8/03/2013 $231.00 7/04/2013 $343.00
project d 3/04/2013 $1,232.00 30/01/1906 $3,122.00 6/07/2013 $666.00
I need to generate a sum for each month/year across all projects and phases of the project. IE:
Jan 2013 $555
Feb 2013 $4,977
What's the best way of going about this?
This is a good use case for pivot tables.
Highlight the date columns, right click, Format Cells.. menu item. Then use a Custom Data format of MM/YY to get everything in month and year format.
Once all the dates are converted, highlight the entire table then make a Pivot Table of the data (use Create Menu). Place pivot table on new sheet.
Use the pivot table to group and sum data as needed. You can drag the various projects into pivot table rows, and then combine cost columns using the sum() function. Add filters or project groups where needed.
If you've never used pivot tables, I highly recommend taking 30 minutes to learn. They are very intuitive and powerful.
Good luck!
A suggestion is to ‘reverse pivot’ (eg as described An excel formula to find a row/column index in array) and double click on the intersect of the Grand Totals. Insert a column with:
=MONTH(Table1[[#This Row],[Value]])&" | "&YEAR(Table1[[#This Row],[Value]])
and a column with, in the first row below the headers (assumed to be Row1): =C3 where C is assumed to be the Value column.
Copy the Table and Paste Special Values.
Filter the Column column and delete all rows containing price.
Sort the month/year column and Subtotal, for each change in that column, the other added column.

find last row data [for the particular]/[filtered by] year in excel

In excel I have data as below.
2011 0
2011 15
2011 10
2011 5
2012 15
2012 10
2012 5
What I want to find is the last row for the respective year so that the output would be
2011 5
2012 5
Any idea how to get this done?
I am looking at this post and found the way for finding last row data, however I need to know how to filter the same by year.
Note: I want to do this using excel pre-defined function. NO macro, NO coding, NO pivot.
Edit 1
=INDEX($B:$B,MAX(IF(LEN($B:$B)>0,ROW($B:$B),0)),1) gives me answer 5. However I want it to fiter by year. Any idea how to get this done?
Edit 2
=OFFSET(B2,MAX(IF(NOT(ISBLANK(B2:B25)),ROW(B2:B25),0))-ROW(B2),0) this also gives last row data.
Is this what you want?
{=INDEX($B$1:$B$7,MAX(IF(A9=$A$1:$A$7,ROW($A$1:$A$7))))}
You must enter this as an array function, so enter copy and paste the code between the {}'s and then press ctrl-shift-enter. The code assumes you have 2011 in cell A9. If you then type 2012 in A10 and copy the formula down it will work.
The basic idea of the formula is:
If any cell in A1:A7 matches A9, add its row number to a list of candidate rows
Take the maximum row number of the list of candidates; say this is k
Use the index function to return the value that is in row k of B1:B7
The easiest way to do this without coding is by using pivot tables.
If you did happen to write an excel formula or function for it you would most likely use the max() function and the vlookup() or hlookup() functions.

Resources