average of corresponding cells for sectioning - excel

I have an excel workbook with paired data sets of the type [columnA=distance:columnB=data] There are thousands of data points.
What I'm looking to do is this: I have a sectioning for column A . I want to find the average of corresponding cells in the data column (column B) for the sectioning.

You have a couple of simple options:
autofilter
filter on column A, then highlight column B and have a look at average value in the bottom right corner in the excel status bar
or create a formula =SUBTOTAL(1, B:B) somewhere in your sheet which ignores hidden cells and works well with autofilter
excel table
same as autofilter, but it comes with built-in TOTAL row feature that you can set up to display the average
=AVERAGEIFS() or similar formula - see e.g.:
Average of a filter of multiple columns in Excel,
Calculating average of specific values

Related

Is there a way to spill fill a column based on count of nonblank cells in adjacent column in Excel?

I am looking to find a way to fill a whole column with the same output, "Yes", based on the number of cells in the adjacent column.
For example, if there's data in A2:A10, I would like B2:B10 to be filled with "Yes". If more data is added to column A, I'd like column B to automatically update / spill the "Yes" into additional rows within B based on the number of entries added to column A.
I'm aware that I can do an =IF(ISBLANK()) statement for each row, but I am trying to reduce the number of formulas. I'd like to try and do this with a single formula within the top row of column B that spills down.
The value in column A can change, I'm only trying to check the number of non-blank values.
I'm using Excel / Office 365.
This is a generic solution for column A containing mixed datatypes:
=REPT("Yes",A2:INDEX(A:A,MAX(IFNA(MATCH(IF({0;1},"Ω",77^77),A:A),0)))<>"")

How to find the conditional minimum of a filtered column?

I would like to find the conditional minimum from a column of data, but have it respond to data filtering.
I have a sheet in excel with a summary section at the top, some graphs plotting various aspects of the data, and the data further down.
The data can be filtered, which updates the graphs, but it does not update the summary section.
The summary section show things like min, max, average, and stdev.
How do I make these respond to data filtering while also being conditional?
Essentially: find the minimum value in column A when column B is equal to X and update the result if any of the columns are filter.
I've looked at SUBTOTAL, but it does not allow conditions.
There is also functions such as SUMPRODUCT((SUBTOTAL(3,OFFSET(INDEX($A$1:$A$10,1,1),ROW($A$1:$A$10)-ROW(INDEX($A$1:$A$10,1,1)),0))=1),($B$1:$B$10="value"),$C$1:$C$10) which calculate the sum of column C, when column B equals "value" and updates when the filter is updated (given that the filter includes columns A, B and C).
If you can add one helper column that would be very helpfull for you, e.g.:
Formula used in D2:
=SUBTOTAL(3,A2)
This formula will end up leaving a 1 for visible cells, a 0 for invisible ones. You could choose to hide this column. We can test against this column in a multi-criteria array formula.
Formula in F1:
=MIN(IF((B2:B7="Z")*(D2:D7=1),C2:C7))
Confirmed through CtrlShiftEnter
Please refer to this example.
You can do the same type of formula's for your other needs (MAX, AVERAGE)

Counting the total amount of rows which bear negative values with corresponding row

I am in need of a formula, which counts the sums of two rows for a whole column.
e.g.
I have data in column A and column B and would like to make a count of the sums for A1+B1, A2+B2, etc.. for around 1800 rows. If one of the columns is empty, it should not be included in the count.
This is to find out how many negatives I have in my column when adding A1 + B1, A2+ B2 and so on...
I try to explain it in the link to the picture.
http://i.stack.imgur.com/HlZPa.png
Basically I could do it with an extra column but since I have 50+ customers I would have to add a column for each to make the diff, so I was hoping to express the Yellow column in a formula so I only have to adapt that instead of insert a calculation column for each column.
Thanks for any tips!
You could filter the rows based on some values to get all rows containing negative value if this is what you wish to achieve.
follow these steps:
Select The column that contains negative values.
click on the "Data" tab.
Click "Filter" or Cntrl+Shift+L.
Click the black arrow pointing down on top of the column you have selected.
Select "Number Filters"
Click "Less Than"
Type 0 (zero) and hit Enter.
you should have only the cells containing negative values displayed.
If you need to get the total rows containing positive values in a column, use this formula
=MIN(COUNTIF(A:A,">0")) where column is "A"
To get the total of negative cells in a row, you can use
=MIN(COUNTIF(A:A,"<0")) where column is "A"

Count values in groups

I have a table with student IDs separated in groups. I need a handy way to count the total number of students in each group and populate it after the last row of each group (marked with ??)
Currently I just enter =COUNT() and then manually figure out the top and bottom borders of the range for each group. Not convenient at all.
I was thinking that a possible solution could be one of the following:
A some kind of pivot table permutation. I failed on this one.
Excel Data->Outline->Subtotals functions. Again, fail. It keeps creating new rows in my table.
A universal formula that can be pasted into each ?? cell. Not the most graceful solution, but still would do.
A macro. As a last remedy if nothing else works.
The following steps will calculate the subtotals while preserving the structuring and formatting of your worksheet.
Put this formula in cell C1 and copy the formula down the column:
=IF(NOT(ISERROR(SEARCH("Total",A1))),COUNTA(INDIRECT("B"&MATCH(LEFT(A1,LEN(A1)-7),A:A,0)+1&".B"&(MATCH(A1,A:A,0)+1))),IF(B1="","",B1))
Apply a conditional format to cell C1 with the formula rule =(MOD(ROW(C1),2)=0) and blue fill to match the shading on the other rows. Copy the format down the column using Paste Special Format.
Either hide column B, or copy the values in column C to column B using Paste Special Values and hide Column C. If you decide to copy the values to column B, you won't need to set the conditional formats.
Here is what the formula does:
First, check whether the formula's row is a Total row, by searching the cell in column A of the row for the word "Total," using the SEARCH function.
If the word "Total" is found:
Determine the range in the worksheet of the student IDs for the group for that total row:
a) Identify the rows in which the words "GroupX" and "GroupX Total" are found by using the MATCH function. With that, you know that the IDs for the group are in a range that starts at, say, row x and ends at row y.
b) With the starting and ending row numbers, construct the address range in which the IDs lie, which has to be the string "B" + (row x) + "." + "B" + (row y).
c) Turn the string into a range reference that can actually used in a formula using the INDIRECT function.
Count the number of students in the group using the COUNTA function and the range, and show that as the formula's result.
If the word "Total" is not found
Check whether the cell in column B is empty
a) If it is empty, show a blank as the formula's result
b) if it is not empty, it must be a student ID, so show the ID as the formula's result.
Add a column (I usually add it to the LEFT of the existing matrix) where you enter a formula from row 2 onwards that fills the blanks in the old column A. Then the old matrix including your new column can be used in a pivot.
So Insert a column left of your matrix, this is column A now. Put a header in Cell A1, for example "Group Name1"
Enter the following formula in cell B2 and extend it to the end:
=IF(B2="",A1,B2) This way your blanks will be filled.
Now apply a pivot on this matrix and there you are.
Maybe not the nicest looking solution, but its quick and works well.
If u have table like this
Students id Name of students group ........
then u can use countif/countifs formula

Extract top 10% of column values in Excel and place in another column

I have an excel spreadsheets with values in one column. What i need is a VBA code that will identify top 10% of column values, and place them in a adjacent column.
Why not ignore VBA and use the percentile function to create a true false column and filter on that.
EG. Is the Value in B2 in the top 10% of values in Column B?
=B2>=PERCENTILE($B$2:$B$17,0.90)

Resources