CountIF in pivot table - excel

I have a data that has both negative and possitive values. I wanted to calculate some statistics from them using Pivot Table for example mean, min, max, variation etc. I also wanted to calculate how many records I have, how many negative records I have and how many possitive.
Liczba z Wp vs NI means Count of Wp vs NI I suppose, and it works fine
Liczba z neg is my Count of negative and I made it using Pivot table tools (Analysis) -> Fields, elements menu and my formula was = 'Wp vs NI' < 0. Then in that right gray panels I changed in \Sigma Wartości (it is Values) from Sum of neg to Count of neg.
Same steps I performed for possitive with > in formula.
How can I make it work?
I know I can create extra column in my data with COUNTIF formula, but I wonder how to use formulas in pivot table.

Related

How to find Quartiles from the data in two columns in excel

Hi I have a basic question. I tried to find the answer by myself but I couldn't. how to contain multi areas in Quartile func in excel? (actually, google spreadsheet)
I know the basic func of quartile is =quartile(data,1). ex) =quartile(A2:A10,1)
Situation: I have a # of trials in column A, and the # of scores in column B. After I had 50 trials, I didn't want the table to be too long. so I have another # of trials in column D(51~100) and # of scores in column E
Main point: I want to find the average, median, and qurtile1, quartile2, quartile3 for all scores of my trials.
I know for average, =average(B2:B51,E2:E51). for median, =median(B2:B51,E2:E51). However, when I do quartile =quartile(B2:B51,E2:E51,1) or =quartile((B2:B51,E2:E51),1) it has an error that I put 3 data and it should be 2. How can I contain the data from two columns?(column B and column E) please let me know. Thank you!
Range unions in Excel are achieved by the following syntax:
(Range1,Range2)
For example:
=QUARTILE((B2:B51,E2:E51),1)
Whereas in Google Sheets it's:
{Range1;Range2}
For example:
=QUARTILE({Range1;Range2},1)

Excel: How to find closest number in table, many times

Excel
Need to find nearest float in a table, for each integer 0..99
https://www.excel-easy.com/examples/closest-match.html explains a great technique for finding the CLOSEST number from an array to a constant cell.
I need to perform this for many values (specifically, find nearest to a vertical list of integers 0..99 from within a list of floats).
Array formulas don't allow the compare-to value (integers) to change as we move down the list of integers, it treats it like a constant location.
I tried Tables, referring to the integers (works) but the formula from the above web site requires an Array operation (F2, control shift Enter), which are not permitted in Tables. Correction: You can enter the formula, control-enter the array function for one cell, copy the formulas, then insert table. Don't change the search cell reference!
Update:
I can still use array operations, but I manually have to copy the desired function into each 100 target cells. No biggie.
Fixed typo in formula. See end of question for details about "perfection".
Example code:
AI4=some integer
AJ4=MATCH(MIN(ABS(Table[float_column]-AI4)), ABS(Table[float_column]-AI4), 0)
repeat for subsequent integers in AI5...AI103
Example data:
0.1 <= matches 0
0.5
0.95 <= matches 1
1.51 <= matches 2
2.89
Consider the case where target=5, and 4.5, 5.5 exist in the list. One gives -0.5 and the other +0.5. Searching for ABS(-.5) will give the first one. Either one is decent, unless your data is non-monotonic.
This still needs a better solution.
Thanks in advance!
I had another problem, which pushed to a better solution.
Specifically, since the Y values for the X that I am interested in can be at varying distances in X, I will interpolate X between the X point before and after. Ie search for less than or equal, also greater than or equal, interpolate the desired X, then interpolate the Y values.
I could go a step further and interpolate N - 1 to N + 1, which will give cleaner results for noisy data.

counting combinations in excel and use as size in bubble chart

In my analysis spreadsheet in Excel, I am scoring stakeholders on power to implement change (P) and their interest in the change (I) of our project. I then want to present that as a bubble chart (10 by 10) where the number of unique combinations (e.g. P-I => 10-8 = 3, number of times this combination is scored = 3) are represented by the size of the bubble on a given point (X=10, Y=8, Size=3).
I have the score in a table including an additional column for the combination (concat P&"-"&I) that I count in pivot table.
This approach does not appear work. How can I achieve my goal?

Python Pandas: Average column if

In MS Excel there is a handy formula =AVERAGEIF(values, criteria).
Is there a similar way to average values within one columns that conform to certain condition?
I have a column of values in my data frame from -5000 to +5000.
I need to average values between -5000 <= x < 0
And separately average values between 0 < x <= 5000.
NOTE: I'd like to avoid applying Boolean mask and therefore creating new dataframe, because I have lots of columns.
Any help, suggestions, or edits to this post are welcome.
Using Boolean mask actually does what I need.
df[df>0].mean(axis=0,skipna=True,numeric_only=True)
It returns as many single values as I have columns. Perfect!

PivotTable - Calculate value depending on combination of row labels

WARNING - Using Excel 2011 for Macs, inexperienced user
Hi All,
I have a sheet in Excel with a bunch of categorical fields and some numerical ones as well. Let's say it looks like the following:
I would like to make a pivot table that will display the average click rate (avg_click_rate) of the unique combinations of [year, region], i.e. the combinations of fields in the pivottable's rows section.
For example, the avg_click_rate of [years=5] is:
(0.5*10)/(10 +5 ) + (0.6*5)/(10+5) = 0.53
while the avg_click_rate of [region=north] is:
(0.6*5)/(5+20) + (0.2*20)/(5+20) = 0.28
and the avg_click_rate of [years=5, region=south] is:
(0.5*10)/10 = 0.5
I know I have to make a custom Calculated Field to do this, but for the life of me I cannot figure out how to code the formula. Any help would be seriously, seriously appreciated.
To be clear, my formula would be:
SUM{ (click_rate * number_members) / SUM{number_members} }
where the numerator is a single value for each row included in the unique combination of [year, region], while the denominator is a constant - the total number_members for the unique combination of [year, region].
You should create a new column in your source table:
product = click_rate * number_members
And then create a Calculated Field in the pivot table:
CF = product / number_members
Using AVERAGEIFS:
AVERAGEIFS($C$2:$C$9,$A$2:$A$9,A2,$B$2:$B$9,B2)
EDIT:
You can add up to 127 conditions, see: AVERAGEIFS function
Criteria_range1, criteria_range2, … are 1 to 127 ranges in which
to evaluate the associated criteria.

Resources