Searching for excel formula that do job in the body - excel

I have table with pupils that did 6 tasks.
Maximum points are 15 and minimum is 0.
Pupil needs to have 12 points in three tasks so he could get extra 10 points.
For example:
N & S TASK 1 TASK 2 TASK 3 TASK 4 TASK 5 TASK 6
Name & Surname | 10 15 0 15 15 5
Which formula / function I need to use that will examine does student have done three tasks with maximum points (15) and if he is sum all tasks points and add 10 to all, else just did summary.
There's photo of my table so you can get better view.
photo

You can use the CountIF function to count how many cells in the row score 15. You can wrap that in another If statement to see if it is true if your count is above x

Related

Doing an operation before SUMIF or MATCH-ing multiple values to multiply before summing

I have an Excel document with multiple small tables in it. Here, each table describes a single project, and at the end of the worksheet, I want to create a summary that doesn't have "hardcoded" locations so that that when the amount of projects (tables) is adjusted, it doesn't break all the formulas. Basically, it looks like this:
A B
1 Project 1
2 Units 200
3 Price / Unit 10
4 Material / Unit 5
5 Handling / Unit 1
6 Total cost 6
7 Profit Margin / Unit 4
8
9 Project 2
10 Units 100
11 Price / Unit 5
12 Material / Unit 1
13 Handling / Unit 1
14 Total cost 2
15 Profit Margin / Unit 3
16
...
19 Summary
20 Units =SUMIF( A$1:A19 ; A20 ; B$1:B19 )
21 Material costs ???
22 Handling costs ???
23 Total Profit ???
Here, there may be an arbitrary amount of projects and I'm unsure how to create a formula that directly calculates the total material costs (and by the same pattern, Handling and Total Profit). For the total units, I can simply use a =SUMIF( A$1:A19 ; A20 ; B$1:B19 ) instead of =B2 + B2 by having the function search col A for the keyword "Units" but in order to do this for the total material costs, I need to multiply first. Eg, it would be =B2*B4 + B10*B12.
My first idea was to use an INDEX MATCH approach to extract a subarray from each table and then sum it all up using SUMPRODUCT however the MATCH function unfortunately only returns the first result and I can't get it to output an array of results (I think this is just a limitation with the function?).
I guess it would also be possible to simply add extra lines to each table to pre-calculate these products, but I don't like that solution as it would give the tables a lot of unnecessary extra bloat and I'd really like to solve this in one formula.
Any help would be greatly appreciated!
I came up with a dirty solution, using SUMPRODUCT formula that works if your using Office 365 :
example calculating total handling cost:
=SUMPRODUCT(FILTER(B:B,A:A="Units"),FILTER(B:B,A:A="Handling / Unit"))
FILTER(B:B,A:A="Units"), returns an array of values on the right of cells containing "Unit"
FILTER(B:B,A:A="Handling / Unit"), returns an array of values on the right of cells containing "Handling / Unit"

How do I count the number of cells in a column against criteria in another column

I need help creating a formula to count number of unique delivery stops each day. The table below is similar to my actual data.
Name
Address
Sun
Mon
Tues
Wed
Bob
1 Main St
1
0
1
2
George
3 Main St
3
0
1
2
Tom
4 Main St
4
0
1
2
Harry
1 Main St
0
0
1
2
Randy
1 Main St
0
0
4
2
Homer
5 Main St
2
0
1
2
Bill
10 Main St
3
0
1
2
Jim
1 Main St
1
0
1
2
Joe
2 Main St
1
0
1
2
For instance, "1 Main St" is marked 4 times on the chart, but on Sunday there were 2 deliveries but only 1 actual stop at that location.
How would I go about calculating that based with a formula? I originally tried a ```=SUMPRODUCT```` but it wasn't calculating correctly, it would count each delivery stop, I'm not sure how to make it not count 0's and to combine multiple deliveries to the same address as a single delivery.
My last formula was "=SUMPRODUCT((COUNTIF($D$6:$D$96,$D$6:$D$96)=1)*$J$8:$J$98)
Where Column D is the addresses and J starts the delivery counts on Sunday.
Thanks
EDIT
Sorry, I wasn't clear with my question: I need a way to count the number of stops made per day (so if an address has multiple deliveries to different people, it's just counted as a single stop and 0's are skipped). Using Excel 2013
After many, many attempts, here it is...
Answer:
=SUM(IF(LEN(UNIQUE(FILTER(B2:B10;C2:C10>0;0);FALSE;FALSE))>1;1;0))
Where B2 is the first address, C2 is the first row under sunday.
This will give you unique delivery locations. So, if you visit the same place multiple times in one day, it is still counted as 1. If 0, it is counted as 0.
Your question was VERY unclear. Next time around, please tell us what you want the result to be.
This answer will give 6 for Sunday. If there are no deliveries, it will be zero. This last point took me hours to solve. COUNTIF won't work on single cells, only arrays. COUNT only works on numbers, COUNTA... Well, apparently COUNTA counts empty arrays (like if FILTER returns nothing). So I had to get the length (>1 for some reason). If it was greater than 1 in length, add 1, otherwise 0. And finally SUM it all.
Like I said, this is to calculate deliveries on Sunday, so this formula will be repeated for the other days.
Hope you like it! ^_^

How to combine SUMPRODUCT with an INDEX and MATCH formula?

Note, I have edited my original question to clarify my problem:
As the title suggests, I am looking for a way to combine the SUMPRODUCT functionalities with an INDEX and MATCH formula, but if a better approach exists to help solve the problem below I am also open to it.
In the below example, imagine that the tables are on different sheets. I have a report that has the sales of each ID in the rows and each month in the columns (first table). Unfortunately, the report only has IDs and not the region they belong to, but I do have a look up table which labels each ID with their respective region (second table):
A
B
C
D
1
ID
January
February
March
2
1
10
5
20
3
3
5
5
10
4
7
0
10
5
5
14
10
25
5
6
25
5
10
10
7
27
10
10
10
8
44
5
5
5
A
B
1
ID
Region
2
1
East
3
3
East
4
7
Central
5
14
Central
6
25
Central
7
27
West
8
44
West
My goal is to be able to aggregate the sales by region as per the result below. However I would only like to show sales data that belong to the month that is shown in cell D2.
Goal:
A
B
C
D
1
Region
Sales
February
2
East
10
3
Central
45
4
West
15
I have used the INDEX and MATCH combination to return a single value, but not sure how I can return multiple values with it and aggregate them at the same time. Any insight would be appreciated!
You may just use:
=SUMPRODUCT((Sheet1!B$1:D$1=D$1)*(Sheet1!H$2:H$8=A2),Sheet1!B2:D8)
Remember, SUMPRODUCT() could be quite heavy processing huge data, therefor to combine INDEX() and MATCH() is not a bad idea, but let's do it the other way around and nest the latter two into SUMPRODUCT() instead =):
=SUMPRODUCT(INDEX(Sheet1!B$2:D$8,0,MATCH(D$2,Sheet1!B$1:D$1,0))*(Sheet1!H$2:H$8=A2))
Another option using SUMIF+INDEX+MATCH function as in
In "Sheet2" B2, copied down :
=SUMIF(Sheet1!H:H,A2,INDEX(Sheet1!B$1:D$1,MATCH(D$2,Sheet1!B$1:D$1,0)))

Excel ranking based on grouping priorities

Hi everyone I have an excel question on how to rank but based first on a a ranking but then next on a second priority of a group. The formula is written in column 'Final_Rank' and I just hid a bunch of rows to show the clear example. Within the column Rank is just a normal rank function. I want the priority to be within Rank first, but then to add the next rank to the next item of the same group*. So if you look at Group HYP it will supersede ranked (3 and 4) and then 5 would be given to the next newest group.
I hope this is a clear explanation, thanks.
Group Rank Final_Rank_Manual
TAM 1 1
HYP 2 2
GAB 3 5
HYO 4 8
ALO 5 9
HYP 7 3
ACO 8 12
IBU 9 13
ACO 11 14
ALO 18 10
GAB 44 6
IBU 53 15
IBU 123 16
GAB 167 7
HYP 199 4
You can do this with an extra helper column. Assuming your table currently occupies columns A-C, with one header row, put the following in C2:
=SMALL(IF($A$2:$A$6=A2,$B$2:$B$6,9999999999),1)+(B2*0.000000001)
You'll need to enter this as an array formula by using Ctrl+Shift+Enter↵. Copy it down throughout the whole column. This gives you the group's ranking, and it adds a tiny decimal indicating the individual values position within each group. (e.g. the 3rd "HYP" value is converted to something like 2.0000000199, because out of all the available values, the second lowest belongs to "HYP", and this specific "HYP" value is 199).
Next, enter the following in D2 and copy it down throughout the column:
=RANK(C2,$C$2:$C$6,1)
This will give you the "Final" rankings. There won't be any ties because of the tiny decimals we added in the previous formula. The results end up looking just like your sample.

SUMPRODUCT INDEX MATCH

With the following data:
A B
1 CUMULATIVE PERCENTAGE OF ITEMS PRODUCED PER MONTH ("COMPLETION_TABLE")
2 Type Month 1 Month 2
3 KITTENS 0 10
4 FISH 0 20
5 BANANAS 2 5
6 APPLES 0 0
7 PEARS 0 5
8 KITTENS 0 5
9
10
11 PRICES TABLE ("PRICES_TABLE")
12 Type Value
13 APPLES 1000
14 BANANAS 5000
15 PEARS 3000
16 FISH 4000
17 KITTENS 2000
I'm attempting to use the SUMPRODUCT function to calculate the percentage change in each month and use that value as a multiple of the prices table to provide a total price per month across all types that have been produced.
I can calculate the movement as:
=SUMPRODUCT((COMPLETION_TABLE[Month 2]-COMPLETION_TABLE[Month 1]))
... but I then need to calculate the portion of the individual movement values against the price for that type and sum the resulting products together. I have been using various INDEX / MATCH combinations without much luck.
As an example: BANANAS which should =(5-2)*5000.
Written as expanded arrays I would like to do
({10;20;5;0;5;5}-{0;0;2;0;0;0})*{2000;4000;5000;1000;3000;2000}.
Use of SUMPRODUCT implies you want a single figure result. You can use SUMIF as a "pseudo lookup" within SUMPRODUCT to get the prices, e.g.
=SUMPRODUCT(C3:C8-B3:B8,SUMIF(A13:A17,A3:A8,B13:B17))
That would get you a result of 140,000 for your example
From your question I understand the result you want is an array. This is what you get with this formula:
=INDEX($B$13:$B$17,MATCH($A3:$A8,$A$13:$A$17,0))*($C3:$C8-$B3:$B8)
entered as an array formula using Ctrl Shift Enter.
I am sure there is something simpler. I am assuming that the Type in the Price Table are unique:
{=(SUM((A13=$A$3:$A$8)*$C$3:$C$8)-SUM((A13=$A$3:$A$8)*$B$3:$B$8))*SUM((A13=$A$13:$A$17)*$B$13:$B$17)

Resources