Excel countif(s) multiples - excel

I'm trying to calculate the count of multiple occurrences of a figure using countif.
I have the range set but I need a calculation which can count in multiples of 50 without me having to type thousands of versions of countif (=COUNTIF(B2:B5,">=50")-COUNTIF(B2:B5,">100" etc.).
Data Count
50 1
70 1
80 1
10 0
150 3
This data should show 6 but at the moment I'm getting 4.

First you can start by making bins. you can make it with Data analysis tool or half manual
Like in the example, on A2 enter 0 and on b2 enter =a2+50
Same goes for a3 enter =b2 and last on a4 =a3+50
Now you can drag it down as much as you like.
Instaed of using countif use sumif finction. let's assume your data is on cloumn H and the values you want to sum are in column I, then on c2 enter
=SUMIFS(I:I,H:H,">"&A2,H:H,"<="&B2)
you can drag it down as much as you like.

Simply use Excels ROUNDDOWN function:
e.g. for B2: =ROUNDDOWN(A2/50,0)

Related

COUNTIF to calculate number of occurances between 2 values

I have no idea what is wrong with my formula and I would like to learn from my mistakes:
I have a range of values, say A1:A100, and I want to count the number of times a value from 0 to 10 appears, 10 - 20 appears etc. and put it into a frequency table.
I am put value 0 and 10 in cells B1 and C1 respectively, 10 and 20 in B2 and C2 respectively etc. (i.e. the frequency table is from columns B to D)
In D1, my formula is:
=COUNTIF($A$1:$A$100,AND(">="&B1,"<="&C1)
However, this formula doesn't seem to work and always returns 0. It would be greatly appreciated if anyone can enlighten me on why my formula doesn't work. Thanks in advance!
Use COUNTIFS for multiple conditions.
=COUNTIFS($A$1:$A$100, ">="&B1, $A$1:$A$100, "<="&C1)

I am trying to find a formula that will allow me to calculate MAX/MIN without calculating anything after the current row

I want to use the Max/Min function to calculate the minimum number up to the current row, but not count anything after that row. See example below:
A B C
1 10 =MIN(A1:A1) I Want B1 to only count MIN from A1 to A1 from here, then
2 14 =MIN(A1:A2) from here I want B2 to count MIN from A1 to A2,
3 9 =MIN(A1:A3) Then A1 to A3,
4 6 =MIN(A1:A4) etc,
5 14 =MIN(A1:A5) etc.
I could go back and update each row manually, but I have over 700 rows that I want all this to apply to. Is there anyone who can help me with a solution to this problem?
Use this formula in B1, and copy downwards:
=MIN($A$1:$A1)
This is called maintaining referential integrity while writing any excel formula. It should give the desired result on copy towards right or downwards.

Finding Top 15 or Top 10% Highest Values in Excel

So I will have a list of players (for fantasy baseball) that includes what team they are on and their salary - 3 columns in total. The number of players will range but could be in the 100-238 range. 238 is the max though.
I need to find the top 15 or 10% most expensive players, whichever is higher once we're done drafting. Therefore I will either have 15 players (if my list is <= 150) or will be the 10% once it gets to 155 and higher (since we're rounding).
Since based on my max I know I'll have anywhere from 15-24 players to pick from I had the following formula in a grid and just dragged down 24 rows. Column I is just numbered 1-24.
=IF(OR(COUNTIF($B$2:$B$501,"*") < 150, I3 <= ROUND(COUNTIF($B$2:$B$501,"*") * 0.1,2)),INDEX($B$2:$B$211,MATCH(1,INDEX(($D$2:$D$211=LARGE($D$2:$D$211,ROWS(J$1:J1)))*(COUNTIF(J$1:J1,$B$2:$B$211)=0),),0)),"-")
However, something is wrong as I keep getting duplicate names when I test this out with test data.
Any ideas where I am wrong?
The difficulty is duplicated salaries.......this can be accomodated......say the data is like:
Clearly Christopher, Mark, and George all share the same salary...to untangle this in E2 enter:
=RANK(D2,$D$2:$D$23,0)+COUNTIF($D$2:$D2,D2)-1
and copy down...........this assigns a unique ID to each record.....In G2 enter:
=MATCH(ROW()-1,$E$2:$E$23,0)
and copy down...in H2 enter:
=OFFSET($B$1,G2,0)
and copy down...in I2 enter:
=OFFSET($C$1,G2,0)
and copy down...finally in J2 enter:
=OFFSET($D$1,G2,0)
and copy down...........we now have:
This is a "sort-by-formula"..........Pick as many names off column H as you choose!

Taking the average of bottom n percent in Excel

I have a column of data in excel that I need to take the average of the bottom 10% of. My data reads:
1
2
3
4
5
6
7
8
9
10
so the average of the bottom 30% would be - (1+2+3)/3 = 2. Is there a way to automate this in excel where all I have to do is give it what percent I want and it gives me the answer?
A simpler version: no Array Formula or Indirect required
Assuming data in column A, and required percentage in cell B1 (as a decimal)
=AVERAGEIF(A:A,"<="&SMALL(A:A,COUNT(A:A)*B1))
I'm not entirely sure what you're looking for when you say 'where all I have to do is give it what percent I want and it gives me the answer', but you could perhaps try AVERAGEIF:
=AVERAGEIF(A1:A10,"<="&COUNTA(A1:A10)*0.3)
Assuming that the data is in the range A1:A10. You can have a reference for the 0.3 for the percentage.
=AVERAGEIF(A1:A10,"<="&COUNTA(A1:A10)*B1)
If you put the percentage in B1, then the formula will change accordingly.
Assuming your data is in A1:A10, and your desired % is in B1:
=AVERAGE(SMALL(A1:A10,ROW(INDIRECT("1:"&(B1*COUNT(A1:A10))))))
Note! This is an Array Formula! That means that you have to enter into the formula bar at the top (not in the cell), and press ctrl shift enter when you're done.
This will wrap the formula in these { }, so you'll know you did it right. Typing them in does not work, you have to ctrl+alt+enter!
How does it work?
ROW(INDIRECT("1:"&(B1*COUNT(A1:A10))))
The Count checks how many items you have in your list, so it knows how many numbers it will need to average. Let's say B1 is 40%.
40% of 10 items is 4, but 40% of 20 is 8.
Since it's 10 entries long, we'll creating an "array", a series of numbers from 1 to 4 (40%).
*SMALL(A1:A10*
SMALL finds the *n*th smallest number in a range. With our array of 1 to 4, it will find the lowest 4 entries.
AVERAGE(
Then we average the result :)

Count data if row is true excel

I have this Data:
var number
a 1
a 4
a 30
b 4
b 50
b 6
b 4
ab 1
I need to find the sum of each time a (var occurs X the number next column right) in excel.
In the case above the answer would be:
a = 36
b = 65
How can I write a formula for this in excel? Can I do this in excel?
Since you are counting the last one as well, I would use this formula:
=SUMIF(A:A,"*"&D2&"*",B:B)
Here, there is the value a in cell B2 and I can drag the formula down for B instead of typing a whole new formula. Handy if you have many like those to look for.
I assume that you have the table you published above in cells A1:B8. In order to do the calculating you would like to do you need to use the array-functionality in Excel. The following syntax in a cell will do:
=SUM(IF("a"=A1:A8,B1:B8))
However, instead of ENTER you need to press COMMAND+SHIFT+ENTER (I am on a Mac so it might be that Windows has a slightly different key combo. The result is that the formula now reads like:
{=SUM(IF("a"=A1:A8,B1:B8))}
This will give you 35 and not 36, but in a similar manner you could sum all the columns with 'ab' and then add that up to the sum of the 'a' columns.
Good luck!

Resources