Excelc calculate a value based on dropdown list selection - excel

Novice excel user here. I am working with Excel 2013
I have 11 cells in a row with dropdown lists. The drop down lists have 6 texts values:
Choose One
Exceptional
Excellent
Successfull
Needs Improvement
Unsuccessful
Depending one which is chosen they need to have values of 5 (exceptional) to 1 (Unsuccessful) and 0 being (Choose One). Some cells may only have Choose One (being not selected). I need to add the add up the total values of what is selected. So if 5 were "Selected", 4 were "Excellent" and 2 were Choose One, the total would be 31. I need to calculate the value of 31 / the number selected which in this case is 9 to equal 3.44. How do I create a formula in a cell to take all of that into consideration?
Thoughts?
Thanks in advance.

Assuming you have your dropdowns from A to K (11 cells),
and the values you indicated, you could use the formula
=COUNTIF(A2:K2,"Exceptional")*5 + COUNTIF(A2:K2,"Excellent")*4 + COUNTIF(A2:K2,"Successful")*3 + COUNTIF(A2:K2,"Needs Improvement")*2 + COUNTIF(A2:K2,"Unsuccessful")*1 + COUNTIF(A2:K2,"Choose One")*0 + COUNTIF(A2:K2,"")*0
to get the totals
you could use the fourmula
=COUNTA(A2:K2)
to give you the number of cells that have some data
then you could simply have the combined formula
=(COUNTIF(A2:K2,"Exceptional")*5 + COUNTIF(A2:K2,"Excellent")*4 + COUNTIF(A2:K2,"Successful")*3 + COUNTIF(A2:K2,"Needs Improvement")*2 + COUNTIF(A2:K2,"Unsuccessful")*1 + COUNTIF(A2:K2,"Choose One")*0 + COUNTIF(A2:K2,"")*0)/COUNTA(A2:K2)
to you give you the number you want

Related

Duplicating Data per number cycle

Im trying to duplicate data down a set of columns based on number cycle. Every time a number in sequence repeats, I'd like the number IM populating to increase by 1.
For example:
A
B
1
1
1
2
1
4
2
1
2
2
2
4
Every time column B repeats its cycle, In this case when it repeats back to 1, 2 ect. I'd like column A to increase by 1.
Initially I thought something like =IF(A3<>A2,B2+1,B2) would suffice, but that repeats.
Is there a different formula I can use to accomplish this?
Depending on your scenario, I'd do this.
These formulas need to originate in cell A2. If you're not working in the top left hand corner of your sheet, you'll need to adjust the formula accordingly.
Scenario 1 - All numbers in the sequence are unique.
=IF(INDIRECT(SUBSTITUTE(ADDRESS(1,B2),"1","") & "1") = B2, MAX($A$1:A1) + 1, MAX($A$1:A1))
Scenario 2 - All numbers in the sequence are NOT unique.
=IF(SUMIF($A$1:A1, MAX($A$1:A1), $A$1:A1) / 6 = MAX($A$1:A1), MAX($A$1:A1) + 1, MAX($A$1:A1))

Sum of the greatest value in one column, plus the sum of the other values in another column

Consider the following sheet/table:
A B
1 90 71
2 40 25
3 60 16
4 110 13
5 87 82
I want to have a general formula in cell C1 that sums the greatest value in column A (which is 110), plus the sum of the other values in column B (which are 71, 25, 16 and 82). I would appreciate if the formula wasn't an array formula (as in requiring Ctrl + Shift + Enter). I don’t have Office 365, I have Excel 2019.
My attempt
Getting the greatest value in column A is easy, we use MAX(A1:A5).
So the formula I want in cell C1 should be something like:
=MAX(A1:A5) + SUM(array_of_values_to_be_summed)
Obtaining the values of the other rows in column B (what I called array_of_values_to_be_summed in the previous formula) is the hard part. I've read about using INDEX, MATCH, their combination, and obtaining arrays by using parenthesis and equal signs, and I've tried that, without success so far.
For example, I noticed that NOT((A1:A5 = MAX(A1:A5))) yields an array/list containing ones (or TRUEs) for the relative position of the rows to be summed, and containing a zero (or FALSE) for the relative position of the row to be omitted. Maybe this is useful, I couldn't find how.
Any ideas? Thanks.
Edit 1 (solution)
I managed to obtain what I wanted. I simply multiplied the array obtained with the NOT formula, by the range B1:B5. The final formula is:
=MAX(A1:A5) + SUM(NOT((A1:A5 = MAX(A1:A5))) * B1:B5)
Edit 2 (duplicate values)
I forgot to explain what the formula should do if there are duplicates in column A. In that case, the first term of my final formula (the term that has the MAX function) would be the one whose corresponding value in column B is smallest, and the value in column B of the other duplicates would be used in the second term (the one containing the SUM function).
For example, consider the following sheet/table:
A B
1 90 71
2 110 25
3 60 16
4 110 13
5 110 82
Based on the above table, the formula should yield 110 + (71 + 25 + 16 + 82) = 304.
Just to give context, the reason I want such a formula is because I’m writing a spreadsheet that automatically calculates the electric current rating of the short-circuit protective device of the feeder of a group of electric motors in a house or building or mall, as required by the article 430.62(A) of the US National Electrical Code. Column A is the current rating of the short-circuit protective device of the branch-circuit of each motors, and column B is the full-load current of each motor.
You can use this formula
=MAX(A1:A5)
+SUM(B1:B5)
-AGGREGATE(15,6,(B1:B5)/(A1:A5=MAX(A1:A5)),1)
Based on #Anupam Chand's hint for max-value-duplicates there could also be min-value-duplicates in column B for corresponding max-value-duplicates in column A. :) This formula would account for that
=SUM(B1:B5)
+(MAX(A1:A5)-AGGREGATE(15,6,(B1:B5)/(A1:A5=MAX(A1:A5)),1))
*SUMPRODUCT((A1:A5=MAX(A1:A5))*(B1:B5=AGGREGATE(15,6,(B1:B5)/(A1:A5=MAX(A1:A5)),1)))
Or with #Anupam Chand's shorter and better readable and overall better style :)
=SUM(B1:B5)
+(MAX(A1:A5)-MINIFS(B1:B5,A1:A5,MAX(A1:A5)))
*COUNTIFS(A1:A5,MAX(A1:A5),B1:B5,MINIFS(B1:B5,A1:A5,MAX(A1:A5)))
The explanation works for bot solutions:
The SUM-part just sums the whole list.
The second line gets the max-value for column A and the corresponding min-value of column B for the max-values in column A and adds or subtracts it respectively.
The third line counts, how many times the corresponding min-value for the max-value occurs and multiplies it with the second line.
Can you try this ?
=MAX(A1:A5)+SUM(B1:B5)-MINIFS(B1:B5,A1:A5,MAX(A1:A5))
What we're doing is adding the max of A to all rows of B and then subtracting the min value of B where A is the max.
If you have Excel 365 you can use the following LET-Formula
=LET(A,A1:A5,
B,B1:B5,
MaxA,MAX(A),
MinBExclude, MINIFS(B,A,MaxA),
sumB1,SUMPRODUCT(B*(A=MaxA)*(B<>MinBExclude)),
sumB2,SUMPRODUCT(B*(A<>MaxA)),
MaxA +sumB1+sumB2
A and B are shortcuts for the two ranges
MaxA returns the max value for A (110)
MinBExclude filters the values of column B by the MaxA-value (25, 13, 82) and returns the min-value of the filtered result (13)
sumB1 returns the sum of the other MaxA values from column B (26 + 82)
sumB2 returns the sum of the values from B where value in A <> MaxA (71 + 60)
and finally the result is returned
If you don't have Excel 365 you can add helper columns for MaxA, MinBExclude, sumB1 and sumB2 and the final result

Count of Excel based on 2 column criteria and counting the 3rd column

I need a count of how many date items fall within Data 1 & Data 2
ie:
x-1 will have a count of 2
x-2 will have a count of 1
-x-3 will have a count of 2
-y-1 will have a count of 2
What would be the best way to go abouts when approaching this?
Data 1
Data 2
Date
x
1
Date 1
x
1
Date 1
x
1
Date 2
x
2
Date 3
x
2
Date 3
y
1
Date 1
y
1
Date 1
I see only one way to interpret with the available information:
To count the number of times Date_to_test falls within Date_1 and Date_2 (screenshot below, sheet here), you could use either the sum or something like a countifs (with interim calc):
sum approach
=SUM(1*($C$2:$C$11<=$B$2:$B$11)*($A$2:$A$11<=$C$2:$C$11))
countifs + interim calc
helper
=1*(C2<=B2)*(A2<=C2)
(additional column, drag down)
countifs
=COUNTIFS($D$2:$D$11,1)
Screenshot
Alternative
as for the 'sum' approach, sumproduct variants (e.g. =SUMPRODUCT(1*($C$2:$C$11<=$B$2:$B$11),1*($B$2:$B$11>=$A$2:$A$11))) are calculation/memory intensive
despite the countifs + helper approach containing more 'visible' data - these values need only be calculated once, the countifs can then be determined independently (assuming no updates to the helper column) - thus making it more memory/calculation efficient depending upon your calculation mode, screen-updating preferences
Caveat
if, by some misfortune re: interpreting your question, you are referring to some other means of establishing whether "date items fall within Data 1 & Data 2", then without knowing what this is, there very low likelihood of being able to guess this correctly

Excel nested IF formula

I want to set a formula that incorporates my school's attendance policy:
3 tardies = 1 unexcused absence
6 tardies = 2 unexcused absences
and so on
The cell must reference not only the cell with the Tardy count, but also the attendance worksheet in the same workbook, and must add the two values. For example, if the attendance page shows 1 unexcused absence and the tardy count shows 7 tardies, the formula needs to return 3.
This is what I've got:
=SUM(Attendance!O9+(IF(J4>=3,1,IF(J4>=6,2,IF(J4>=9,3,IF(J4>=12,4,))))))
It works for 4 tardies and 1 unexcused absence, but continues to return 2 for 7 tardies and 1 unexcused absence.
What am I missing?
Much easier than using If/Then:
=Attendance!O9+(Int(J4/3))
The Int function returns the floor integer of the calculation, J4/3. So, if J4 = 7, the result is 2. If J4=9, the result is 3, etc.
Your if statements are backwards you should check for bigger numbers first in this case otherwise the first if is always true. so 7 is falling true on >= 3 therefore you get 1 + 1 = 2
EDIT - a better way to do it would be to take your J4 divide it by 3 and return the value without the remainder
QUOTIENT(J4, 3)
The if part of your formula should be as follows
IF(J4<3,0,(IF(J4<6,1,(IF(J4<9,2,IF(J4<12,3,4))))))
Bear in mind that this formulae limits you to a maximum of 4 unexcused absences for tardies.
A better solution would be to use the QUOTIENT formula
= Attendance!O9 + QUOTIENT(J4,3)

Finding SUM except some columns

Below is what I have.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ A + B + C + D + E + F + G + H + I + J + K +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 50 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
To find the SUM of this row excluding Cell E I am using formulae as below.
=SUM(A1:D1)+SUM(F1:J1)
NOTE : Cell K have SUM.
Is there any alternate way??
Above is just an example however in my sheet there are around 100 columns and I need to exclude around 10-15 columns.
If you add a row like this:
Row2: yes yes yes yes no yes yes yes yes yes no ...
(being columns A:K)
Then the answer could be
=SUMIF(2:2,"yes",1:1)
I believe
=SUM(A1:J1)-E1
conveys your intention more clearly. (provided the excluded columns contain numbers, of course)
I do think that this is an alternate way
=SUM(A1:D1;F1:J1)
The common approach to address this problem in Excel is to apply the SUM function to the entire range and to substract the exception list out of it, again with the SUM function, this time with a discrete list of individual cells to sum:
=SUM(<range to sum>)-SUM(<exception cell 1>, <exception cell 2>, ...)
This applied to your current example of ~100 cells to sum with say 5 exceptions:
=SUM(A1:CV1)-SUM(E1,M1,Y1,AB1,BU1)
If you want to get your Excel spreadsheet more flexible to those columns exclusion, you may consider to define a named range on the discrete selection of your columns to exclude. If you use it in the substraction SUM formula, you will avoid to change the formula when additional columns need to be excluded : you will only need to change the named range specification.
=SUM(A1:J1)-SUM(A1:J1 Exclusion_List)
where Exclusion_List is a named range on the distinct columns to exclude

Resources