a noobie Excel question.
I have a sample spreadsheet as below:
As you can see I can calculate how many times the unique Traders have appeared by using COUNTIF. However, I can't figure out how count them by month. For example, Tailwind Traders Alpha $ has appeared FOUR times for the month of November.
I just can't figure out the formula and have no idea how to combine formulas.
Any pointers would be appreciated.
For C16 you could put formula:
=SUMPRODUCT((ISNUMBER(SEARCH("*alpha $*",$A$2:$A$11)))*(MONTH($B$2:$B$11)=MONTH(C$15))*(YEAR($B$2:$B$11)=YEAR(C$15)))
You could also use COUNTIFS()
=COUNTIFS($B$2:$B$11,">="&C$15,$B$2:$B$11,"<"&EDATE(C$15,1),$A$2:$A$11,"*alpha*")
To make it more dynamic, you should replace your value in A16 with Alpha $ and then use this formula in C16:
=COUNTIFS($B$2:$B$11,">="&C$15,$B$2:$B$11,"<"&EDATE(C$15,1),$A$2:$A$11,"*"&$A16)
Drag down and right...
Drag right.
Related
The solution I'm looking for is a non-vba one, hopefully there's any.
I'm planning to build a formula at B7, something like =SUM(B3:B5), but the value B3 and B5 is taken from C7 and D7.
I'm working on a weekly employee salary tables, a sheet can contain some employee salary tables, broken down into week by week, using the ordinary SUM function will take more efforts, so I'm looking for an easier way to do it.
Any clues would be much appreciated.
This is my solution, use the following formula:
=SUM(INDIRECT(CONCATENATE(C7,":",D7)))
CONCATENATE to join both cells in order to form the range C7:D7.
INDIRECT to transform your text into a valid range.
SUM to sum the specified range.
To avoid this you could also choose to show the total value in a different column and a simple =sum($B:$B) would do.
But above is the answer to your specific question.
I am supposed to sum up the total highlighted numbers and add the sum in the red marked cell beside the average number. I am using a basic SUM formula to add the cells. I have a couple thousand lines to do this with and I have to manually change the SUM formula to include the right ranges (as some have 4 numbers to add up, some have 3 and others have 2). Is there a way to write the formula so it SUMS all the numbers up until the Average line above it? So I can use the same formula throughout my sheet and not have to change it for every line?
No need for Array formulas.
I will assume you are starting in H2. As per your photo in the discussion
=IF(E2 = "Average",SUMIF($E$1:E1,"<>Average",$G$1:G1)-SUM($H$1:H1),"")
And copy down.
You could use a variable range within a SUM function, using INDEX and MATCH to find the previous instance of Average.
Something like this - an array formula, so enter with Ctrl+Shift+Enter:
=SUM(B3:INDEX(B$1:B3,IFERROR(MATCH(2,1/(A$1:A3="Average")),0)+1))
My question is relatively simple I believe, just not getting it just yet. So here is where I am having trouble,
Let's say, Column C has numbers from C3:C33, I have other items underneath C33 but want to have a SUM of C3:C33 in Column J4 as total. That is easy enough, but when I try inserting a line at C33 to add an additional number, it doesn't automatically SUM in the cell J4. I've looked for answers and I've came across this formula:
=SUM(INDIRECT("C3:C"&ROW()-1))
That works right under C33, and works fine if I have J4 =C33 and just simply hide that formula's row. But I'm wondering is there another Formula that will automatically auto adjust SUM from J4?
Any help would be great!
-Maykid
Use:
=SUM(C3:INDEX(C:C,MATCH("Totals",A:A,0)-1))
Now no matter the number of rows, it will sum only those from C3 to the row above where Totals is found in column A.
Try to use SUM(C3:C34) and leave C34 blank. You should now be able to insert below C33 and the formula should automatically adjust.
I have a problem in Excel. I'm making a program to monitor the consumption of fuel per month. As I do not tank fuel every day, but only every couple days I'd like the program to measure aritchmetic mean for me.
This means it would take the last input and count all blank cells above (excluding my previous input) and measure the mean of fuel consumption in these days.
Example of how it should work:
[link to image] http://i64.tinypic.com/2dre87m.jpg
Edit: If anybody knows how to count number of empty cells between 2 inputs it would also suffice to me.
I was able to get your desired results using an array formula. Assuming your headings Day,Fuel, and Average are in cells A1, B1, and C1 respectively; copy and paste the following formula in cell C2 hit CTRL+SHIFT+ENTER and drag the formula down your column.
=IFERROR(IF(B2="","",(B2/(LARGE(IFERROR(MATCH($B$2:B2,$B$2:B2,0),""),1)-LARGE(IFERROR(MATCH($B$2:B2,$B$2:B2,0),""),2)))),B2)
It gave me a "formula omits adjacent cells" error, but we want to omit the cells below the target row on purpose, so just ignore the error. Hope this helps.
Try this formula:
=IF(B2="","",ABS(B2/(MATCH(0,B$2:B2,-1)-SUM(MATCH(0,B1:B$2,-1)))))
in C2 and copy down.
if cells in column B can contain string values then you can use this formula:
=IF(ISNUMBER(B2),ABS(B2/(MATCH(0,B$2:B2,-1)-SUM(MATCH(0,B1:B$2,-1)))),"")
I have a column with dates of events. ( let's say: A1:A100 )
Now I want to use a formula to find or display the number of events that occurred in January 2013.
Any ideas ?
What you need is an array formula, sometimes called "CSE" formulas because of the way you have to enter them:
Pick your destination cell and select it.
Then, in the formula bar, enter:
=SUM(IF((A1:A100>=DATEVALUE("1/1/2013"))*(A1:A100<=DATEVALUE("31/1/2013")),1,0))
And instead of [enter], press [ctrl]+[shift]+[enter]
I really don't understand why MS make you do the CSE thing- surely it's clear from the format that it's an array formula?
How about using Countifs to find records between a start and end date? You can either type the dates or point it to two cells containing the dates. Not sure which version of Excel you are using, but CountIfs is not supported in 2003 but beyond.
=COUNTIFS(A2:A100,">="&C2,A2:A100,"<="&C3)
or
=COUNTIFS(A2:A100,">=1/1/2013",A2:A100,"<=31/1/2013")
Use the FREQUENCY formula together with an auxiliary MONTH function:
Enter the number 1-12 in your results table (e.g. in D1:D12)
Select the the twelve adjacent cells (in the example it would be E1:E12) and enter =FREQUENCY(MONTH(A1:A1000),D1:D12) - enter the formula as array formula (i.e. press Ctrl-Shift-Enter instead of Enter)
In case you want to also separate by years, you need to modify your keys in column D and your formula to derive the key, e.g. instead of MONTH(A1:A1000) you could use MONTH(A1:A1000)&"-"&YEAR(A1:A1000) - or (if purely used in an one Locale environment TEXT(A1:A1000,"MM-YY").
A couple of ideas:
Use the SUMPRODUCT formula to summarize by month. See example: http://www.contextures.com/xlFunctions04.html#SumProduct
Use a Pivot table:
Add a column B =month(a1). Fill down.
Add a column C of all 1s.
Give A, B, C header names: Date, Month, Count.
Insert a Pivot table based on A,B,C. Now you can easily Sum by Month.
A formula (if you know exactly which month you are looking for):
Perhaps do a fill down in column B with a formula like this:
=if(and(month(a1)=1,year(a1)=2013),1,0), then sum() column B?
Use Consolidate functionality. Take a look at: http://www.techrepublic.com/blog/window-on-windows/use-consolidate-to-summarize-excel-data-without-sorting/6521