Excel Formula to calculate Average rating out of 5 - excel

I have a table of data where ratings are given as V good - 3, Good - 2, Avg - 1 but if the value is NA I want to exclude that from Avg.
I do have values stored as Good, V Good, Avg against the record.
Any excel formula for this to calculate rating out of 5.
Thanks in advance.

Please try this formula. It's designed for entry in a cell in row 2 from where it can be copied down.
=IFERROR(SUMPRODUCT((COUNTIF(C2:E2,{"V Good","Good","Avg"})*{3,2,1}))/SUMPRODUCT((COUNTIF(C2:E2,{"V Good","Good","Avg"}))), "NA")
There are only 3 columns in your example. Therefore I don't understand your request for a "rating out of 5". However, you can use the same formula on a larger range, of 5 or more columns. Just change both range references to include more columns, like E2:G2. The important thing is to change both to the same size of range.

Related

Displaying a label, sorted in a third column pulled from the first column according to data in the second column? i.e. Ranking

Imagine you have spreadsheet with data in a fixed # of contiguous rows.. let's say row 1 through row 20
Now let's say you have 3 columns of interest.
A, B and C
Column A is a label column.. the data in there are just string labels.. let's say types of canned food.. Tuna, Spam, Sardines, etc.
Column B is our number column.. let's say it is prices. e.g. 2 for Tuna, 5 for Spam and 3 for Sardines. These prices can change often very rapidly.. ok so prices are not the best example but let's imagine that prices change rapidly.
Now Column C is where we want to put the formula.
I would like to have a formula in Column C that will pull the labels from Column A, based on their prices in column B and rank them from highest to lowest.. that is C1 would calculate to "Spam", C2 to "Sardines" and C3 to "Tuna"
right now there are 20 rows of data.. but maybe at some other point there might be 30 or 6 or 40, etc.
So can someone help me out with the formula or at least explain what functions I need to use and the general idea involved? thanks
=IF(A2:A200<>"";SORTBY(A2:A200;B2:B200;-1);"")
You can simply use SORT formula. In this case =SORT(A1:B1000,2,-1) where A1:B1000 is range to be sorted, second parameter 2 is column number from range to sort by, 3rd parameter for order (-1 is desceding).
Place formula in C1 and you will get spilled array.

I'm trying to reduce ten columns of Excel formulas into one cell with one large, nested command if possible

Weights
I have built a tab in an Excel spreadsheet that uses base data from 6 columns and then formulas in 9 additional columns that determine the final result in another column, which then gets copied into another cell on another tab (see 'weights' picture at top of this post):
The base data is in 6 columns A-F and has 729 rows - each column has a certain weight (30%, 20%, 20%, 10%, 15%, 5%). Each cell is either 1, 2, 3, 4, 5, N/A, or blank. The goal is to look for N/A or blanks and then redistribute the weight for those categories to the remaining non-N/A and non-blank categories, so if the 20% column was N/A and the other 5 columns were 1, 2, 3, 4, or 5, I would add 4% to each of the 5 scored categories to calculate the final score. Everything works great but I am interested in doing everything in one column after the 6 base columns. I start by converting N/A to 0 and then handle things in multiple columns by doing this:
In Column G, I get the total weight of the columns with N/A or 0:
=SUMIF(A2:F2,0,$A$729:$F$729)
Then in Column H, I get the number of columns that the weight percentage in Column G will get distributed to:
=COUNTIF(A2:F2,">0")
Then in Column I, I calculate the percentage to be added to the remaining columns:
=IF(H2=0,0,SUM(G2/H2))
Then in Columns J-O, I calculate the new weight percentages for each weight (the original weight percentages are in cells H2-H7 on a different tab called 'Controls':
=SUM(Controls!$H$2+$I2) is for Column J, =SUM(Controls!$H$3+$I2) is for Column K, etc.
Then finally I calculate the 'new' score with the 'new' weights. If there were no N/A or 0's, it keeps the original overall score and if not it multiples the score in a cell (1,2,3,4,5) by the new weight and adds the six totals together:
=IF(H2=6,Q2,SUM(A2J2)+(B2K2)+(C2L2)+(D2M2)+(E2N2)+(F2O2))
It all works great, but how can do what I'm doing in 10 columns with just one statement in one cell? I'm assuming there are lots of elegant references and nesting required but I'm not sure how to do it.
Thanks in advance!
You can do this step by step:
e.g.
cell (G2) =SUMIF(A2:F2,0,$A$729:$F$729)
cell (H2) = COUNTIF(A2:F2,">0")
cell (I2) =IF(H2=0,0,SUM(G2/H2))
In cell I2 replace the cell references of G2 and H2 with the formula expression of the respective cells.
More elegant with LET:
https://support.microsoft.com/en-us/office/let-function-34842dd8-b92b-4d3f-b325-b8b8f9908999

How to create a dynamic formula to find the average of a set of values for a given vector

I am trying to create a formula that gives me the average of the last 12 entries in a given dataset depending on the associated vector.
Let's make an example:
I have in column F2,G2,H2 and I2 dates, Company1, Company2 and Company3 respectively. Then from row3 to row 33 I have months dates starting from May 2016.
Date Company1 Company2 Company3
May-16 2,453,845
Jun-16 13,099,823
Jul-16 14,159,037
Aug-16 38,589,050 8,866,101
Sep-16 63,290,285 13,242,522
Oct-16 94,005,364 14,841,793
Nov-16 123,774,792 7,903,600 41,489,883
Dec-16 93,355,037 12,449,604 69,117,105
Jan-17 47,869,982 13,830,712 83,913,764
Feb-17 77,109,905 10,361,555 68,176,643
The goal is to create a formula that, when I drag it down, correctly calculates the average of the last 12 values for a given company.
So for example i would have, say in table "B2:C5":
Company1 76,856,345
Company2 11,120,859
Company3 65,674,349
And, if a new Company4 is added to the list, then I just have to drag it down the formula, to calculate the average of the last 12 months for Company4.
Until now, I have came up with this formula:
=AVERAGE(LOOKUP(LARGE(IF(ISNUMBER(G:G),ROW(G:G)),ROW(INDIRECT("1:"&MIN(12,COUNT(G:G))))),ROW(G:G),G:G ))
This formula correctly calculates the average of a given column, considering only the last 12 values. The last step would be to come up with a formula that includes all the columns and then calculates the average for the given company.
Thanks!
I recommend that you use a named range to define your data in columns G:I. When a company is added, just modify the named range's specs. I used the name Target. Of course, you can replace it with $G:$I if you feel so inclined but I would rather recommend reducing the number of rows in the range, which is easier to manage when it is named.
Use the formula below to extract the company names from the first row of Target into the first column of your averages table. This is to ensure that the names are spelled identically in both locations.
=INDEX(Target,1,ROW()-2)
The number 2 indicates the number of rows above the row containing the formula. it is copied here from cell M3. There, ROW()-2 creates the number 1, counting sequentially as the formula is copied down.
Now I have the formula below in my cell N3 and copied down.
=SUM(INDEX(Target,0,MATCH($M3,INDEX(Target,1,0),0)))
The formula simply sums up the columns G, H, and I in 3 consecutive rows.
In the final step I inserted the range definition established above, meaning excluding the SUM() function, into your existing formula.
=AVERAGE(LOOKUP(LARGE(IF(ISNUMBER(INDEX(Target,0,MATCH($M3,INDEX(Target,1,0),0))),ROW(INDEX(Target,0,MATCH($M3,INDEX(Target,1,0),0)))),ROW(INDIRECT("1:"&MIN(12,COUNT(INDEX(Target,0,MATCH($M3,INDEX(Target,1,0),0))))))),ROW(INDEX(Target,0,MATCH($M3,INDEX(Target,1,0),0))),INDEX(Target,0,MATCH($M3,INDEX(Target,1,0),0))))

How to sum the bottom value of a column that changes size?

So I'm tracking some investments in excel and the columns of interest are the total value of investments, the value for each investment, date. I have a formula for the net total to the side and I'm using this to manually type the net total into the column. I'm also using this data to create graphs of value vs date.
How can I change this formula so it will always just add up the final values for the total of each investments? I dont want to have to manually fudge the formula everytime I update the tables.
I want to do this because the table is a bit busy due to the data needed for the graphs, it'd be nice just to have the net total by the side and highlighted.
net total date 1 2 3
111 13/01/18 100 10 1 Net total: `Sum(c2, d2, e2)`
121 14/01/18 100 20 1
So I want the net total to just sum the bottom values for columns titled 1, 2, 3. I want it to be dynamic so i can then just type in the net total into the correct column and i can update all the graphs. But also want the net total to be on the side for easy viewing too instead of it getting lost in the raw data
there is a trick using "lookup()":
search(999999;A:A) returns value equals to 999999 or last value if 999999 is greater than every values. So your formula will be:
Net total: "lookup(999999999;C:C)+lookup(999999999;D:D)+lookup(999999999;E:E)"
(assuming none of the values is greatrer than 999999999)
Will the final value from each column always be the same row? If so then this formula will sum the last row in columns B, C and D by finding the last number in column B
=SUM(INDEX(B:D,MATCH(99^99,B:B),0))

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 :)

Resources