Excluding 'N/A' answers in Excel table - excel

Say I have a table of survey results. The scores for each answer are from 1-4 inclusive (1 worst, 4 best). An 'N/A' answer is represented as 5 - misleading when analysing!
I want to use a function in the final column that calculates the respondent's overall score for the survey. Rather than replacing 5 with 0 for a 'N/A' answer, I'd like to simply exclude that number altogether, and also exclude it from the overall maximum.
For example, say my maximum overall survey score was 80. If someone puts 'N/A' for one question, then I'd like their score to be n / 76, rather than n / 80.
Any suggestions? Feel free to ask for clarification if needed.
EDIT: See below for example image. I'm trying to get Overall Score / Max Score.

So after playing around with the available functions I stumbled across 2: COUNTIF and SUMIF.
As above, I'm trying to calculate Overall Score / Max Score.
So the formula I use is:
=SUMIF(range, "<5") / (COUNTIF(range, "<5")*4)
Stepping through the function:
=SUMIF(range, "<5") calculates the overall score (any number less than 5, ignores text)
(COUNTIF(range, "<5")*4) calculates the number of cells with numbers less than 5, ignores text. I then multiply this by the maximum score for a given question (which was 4). This gives me the maximum score possible given the number of 'N/A' responses.
Finally I divide the former by the latter and get the score I'm looking for. Hope this helps!

Related

Split total by percentage and receive the same result

This is a little bit complicated to describe, but I will try my best. I have a total, let's say 1000. Then I want to split it by percentages, position count is all the time different. So there can be 3 or 70 or 130 positions or whatever. Then split sum should correspond to target value.
Here is an example of the case:
I input names under Customer request
I enter percentage for position under Percentage
In amount calculation I use =CEILING($C$5*C10;10) and in all the rest of the cells the same to get numbers look nice. It is working fine but he problem is that now totals does not match. It should end up in 15550 but after calculating totals after split it is 15660.
Is there any ideas what kind of master artificial intelligent formula can do the trick to produce nice looking numbers, taking in consideration to match Total (target) in the end if Total (calculated) percentage is 100%?
P.S. Any ideas are welcomed as well. The target is to have nice looking, rounded numbers that will sum in the same number as target - total.
Since you are using CEILING, your output number (e.g. 15660) is guaranteed to be greater than or equal to your input number (e.g. 15550). This is because any time a "perfect match" isn't found, it rounds up.
My first suggestion is to instead use ROUND instead of CEILING. Right off the bat this will perform better than CEILING because ROUND can round up or down but CEILING can only round up.
E.g. try this:
= ROUND($C$5*C10,-1)
Since you provide no details as to "how" the data needs to be adjusted to meet your input value, I can't really provide any automatic solution.
One manual solution is that you can make a new column which indicates whether the data was rounded up or rounded down, and you can adjust the percentages manually to get the data you're looking for.
Here's a formula to tell you if the data is rounded up or down (e.g. put formula in cell E10 and drag down):
= CHOOSE(SIGN(D10-($C$5*C10))+2,"Round Down","Perfect Match","Round Up")
You can use this information to manually tweak your percentages. For example... if your output value is too high, you can slightly decrease some of the higher percentages that "Round Up" and slightly increase some of the lower percentages (e.g. if you have 10% and 3%, maybe change them to 10.1% and 2.9% to see if that makes a difference.)

count how often a piece of information appears and calculate that average

I do not want to know the traditional frequency or the traditional averages; so I'll give an example below:
I have this data:
1
3
5
5
2
3
5
5
1
3
The analysis that I would like to obtain is the following:
for example number 1 appears once every eight rows, number 3 appears once every four rows, number 5 appears twice every two rows....
I did it by hand, but now I have more than 21000 rows of data and I'm stuck.
I searched but I can not find a function that does it; But before I started developing my own, I decided to ask for a guide on how to achieve it.
I believe that I was able to achieve the desired result:
The formula is:
Or, if you want to copy/paste:
=IF(CONCATENATE("1-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+1,1,4)&":A17"),0))="1-1",CONCATENATE("2-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+2,1,4)&":A17"),0)-1),CONCATENATE("1-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+1,1,4)&":A17"),0)))
Note that the IF function solves the duplicates (like the number 5). In case you have triplicates you will have to add another instance of IF and adjust the formula accordingly.
Hope that helps!
Well this doesn't exactly reproduce your results, but you could start by looking at the max and min separation of the numbers:
=IF(COUNTIF(A$1:A$10,C2)<=1,"",MIN(IF((ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))>1)
*(ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))<=COUNTIF(A$1:A$10,C2)),
FREQUENCY(IF(A$1:A$10<>C2,ROW(A$1:A$10)),IF(A$1:A$10=C2,ROW(A$1:A$10)))))+1)
=IF(COUNTIF(A$1:A$10,C2)<=1,"",MAX(IF((ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))>1)
*(ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))<=COUNTIF(A$1:A$10,C2)),
FREQUENCY(IF(A$1:A$10<>C2,ROW(A$1:A$10)),IF(A$1:A$10=C2,ROW(A$1:A$10)))))+1)
This gives the min or max number of rows between each occurrence of the particular number.
Must be entered as an array formula using CtrlShiftEnter
You could add other statistics (like mean, standard deviation) the same way although the average could be calculated just by (lastrow-firstrow)/(count-1) e.g. for 5 it would be (8-3)/(4-1)=5/3.

Excel: Dividing numbers and using the remainders

Little issue I'm having that I'm hoping someone can help me with please?
So I have 3 columns in Excel. Each Column (A/B/C) contains either "high" / "Medium" / "Low" scored issues. However, if you have 3 Low issues, this is grouped together, and this becomes 1 Medium Issue for example.
The difficulty I'm having is writing a formula that will do this for me. Obviously I could just divide the number of Low issues I have by 3, but in the case where I have 7 Low issues, It should result with 2 Mediums and 1 remaining Low. I've tried using the "Mod" function, but that only returns the remainder.
What I need is a formula that will say "If you have 7 Low Issues, (3 low = 1 medium), therefore you have 2 medium and 1 Low). The medium issues would then be added to the Medium Column (Col B), and the remaining low issue is counted in the Low issue column (Col C).
I hope this explanation makes sense, fingers crossed one of you might be able to help me! Thank you in advance
As requested, a screenshot!
If I understand you correctly, I think you should be able to adapt the following formulas to meet your needs.
To get the number of occurrences of the word "Low" in column A:
=COUNTIF(A:A, "=Low")
To get the number of "Mediums" from 3 occurrences of "Low" in column A, round down the above number divided by 3:
=FLOOR(COUNTIF(A:A, "=Low")/3,1)
To get the remaining "Lows" after groupings of 3 into "Mediums", use MOD:
=MOD(COUNTIF(A:A, "=Low"),3)
Putting this into a worksheet:
Values
Formulas
Finally, if you wanted one "Mediums" count, i.e. adding the remaining "Mediums" which aren't grouped into "Highs", you would use a combination of the above formulas for what is left after grouping to "Highs" with what is gained from grouping of "Lows".
Edit:
Now you've included an image, I can show how these formulas are directly applicable...
Values
Formulas
Sounds like you were already nearly there with using =MOD() just needed a little tweak:
For the high column:
=COUNTA(A2:A8)+FLOOR(COUNTA(B2:B8)/3,1)
For the medium column:
=FLOOR(COUNTA(C2:C8)/3,1)+MOD(COUNTA(B2:B8),3)
For the low column:
=MOD(COUNTA(C2:C8),3)
It's exactly like a long addition that you do at school where each column carries over to the one to the left of it (except base 3 instead of base 10). I'm not clear that existing answers cover the case where there is a carry from one column and that causes a further carry from the next column so here is another answer
In the totals row (e.g. for the medium column) in (say) C12
=COUNTA(C2:C10)+INT(D12/3)
Then use mod as before
=MOD(C12,3)
except that in the high column you don't want to use MOD so it's just
=B12

Optimization of a list in Excel with Variables

I have a list of 153 golfers with associated salaries and average scores.
I want to find the combination of 6 golfers that optimizes avg score and keeps salary under $50,000.
I've tried using Solver, but I am stuck! Can anyone help please? :)
Illustrating a solution that is pretty close to what #ErwinKalvelagen suggested.
Column A is the names of the 153 golfers
Column B is the golfers salaries (generated by =RANDBETWEEN(50, 125)*100, filled down, then Copy/Paste Values)
Column C is the golfers average scores (generated by =RANDBETWEEN(70, 85), filled down, then Copy/Paste Values)
Column D is a 0 or 1 to indicate if the golfer is included.
Cell F2 is the total salary, given by =SUMPRODUCT(B2:B154,D2:D154)
Cell G2 is the number of golfers, given by =SUM(D2:D154)
Cell H2 is the average score of the team, given by =SUMPRODUCT(C2:C154,D2:D154)/G2
The page looks like this, before setting up Solver ...
The Solver setup looks like this ...
According to the help, it says to use Evolutionary engine for non-smooth problems. In Options, I needed to increase the Maximum Time without improvement from 30 to 300 (60 may have been good enough).
It took a couple of minutes for it to complete. It reached the solution of 70 fairly quickly, but spent more time looking for a better answer.
And here are the six golfers it came up with.
Of the golfers with an average of 70, it could have found a lower salary.
In Cell I2 added the formula =F2+F2*(H2-70) which is essentially salary penalized by increases in average score above 70 ...
... and use the same Solver setup, except to minimize Cell I2 instead of H2 ...
and these are the golfers it chose ...
Again - it looks like there is still a better solution. It could have picked Name97 instead of Name96.
This is a simple optimization problem that can be solved using Excel solver (just use "Simplex Lp solver" -- somewhat of a misnomer as we will use it here to solve an integer programming or MIP problem).
You need one column with 153 binary (BIN) variables (Excels limit is I believe 200). Make sure you add a constraint to set the values to Binary. Lets call this column INCLUDE; Solver will fill it with 0 or 1 values. Sum these values, and add a constraint with SUMINCLUDE=6. Then add a column with INCLUDE * SCORE. Sum this column and this is your objective (optimizing the average is the same as optimizing the sum). Then add a column with INCLUDE*SALARY and sum these. Add a constraint with SUMSALARY <= 50k. Press solve and done.
I don't agree with claims that Excel will crash on this or that this does not fit within the limits of Excels solver. (I really tried this out).
I prefer the simplex method above the evolutionary solver as the simplex solver is more suitable for this problem: it is faster (simplex takes < 1 seconds) and provides optimal solutions (evolutionary solver gives often suboptimal solutions).
If you want to solve this problem with Matlab a function to look at is intlinprog (Optimization Toolbox).
To be complete: this is the mathematical model we are solving here:
Results with random data:
....

Give 9 gifts to 5 users

Ive created a game and in that game played 5 users which collected few points, Ive gived gifts manually but for next games how can i split or make in excel to calculate number of gifts,
this is ok using number format with 0 decimal places, 6+1+1+1 = 9
but in cases like this:
1+6+1+1+1 = 10, how can I make that only 9 gifts results?
You should be comparing their percent (B2/SUM(B2:B6)) against each prize as it relates to the total prize (e.g. 1/9). Since you are comparing decimal numbers with another decimal number and expecting an integer (no. of prizes), you will be rounding either up or down depending on whether you are favoring a wider distribution of the prizes or favoring the top score.
Either way you are going to have to decide whether the lowest score should always receive a prize or if the highest score should benefit from the points awarded.
The three possible formulas to start with would be,
=MROUND(C2, 1/9)*9 ◄ closest to even distribution
=FLOOR(C2, 1/9)*9 ◄ favours wider prize distribution
=CEILING(C2, 1/9)*9 ◄ rewards highest awarded points
Fill down as necessary.
Now you have to either take the highest or lowest score and adjust that to compensate for rounding the division of decimal numbers to an integer. MROUND doesn't play well with SUMPRODUCT but these two may give you a solution that you can live with.
=FLOOR($C2, 1/9)*9-((SUMPRODUCT(FLOOR($C$2:$C$6, 1/9)*9)-9)*($C2=MAX($C$2:$C$6)))
=CEILING($C2, 1/9)*9-((SUMPRODUCT(CEILING($C$2:$C$6, 1/9)*9)-9)*($C2=MAX($C$2:$C$6)))
Fill down as necessary.
If the MROUND solution is best suited to your prize distribution model, use a helper column that can determine the MROUND returns and then adjust the high score according to the sum of the helper column without circular references.

Resources