i tried to adapt this post to mine and did have success:
Using SUMIFS with multiple AND OR conditions
it is almost that one, but I'm stuck.
A B C D E F
n/a name S/F due date cut by cutter
abc 25 Sep-29 Sep-28 H
cde 30 Sep-29 Sep-27 E
efg 35 Sep-29 Sep-27 E
abc 40 Sep-29 Sep-27 H
Want do sumif or something that result in: classify by cutter and date, like this:
9/27 9/28 9/29
Eleanor 65 s/f 00 s/f 00 s/f
Hernan 40 s/f 25 s/f 25 s/f
using the following:
=SUMIF(G3639:G3653,"="&Y3654,C3639:C3653)+SUMIF(F3638:F3654,"="&Z3653,C3638:C3654)
it is working double, if I filled my column F with date, its sum twice, I also tried to use "*" instead "+" and didn't work...
I know its make sense to me, and wont for anyone who is reading, but it is a start.
----------above was an example, below real--------------
........"B"......"C"........."E".........."F"......... G
.....customer.....S/F.......Pick up......Cut by:.....Cutter
.....Chelmsford....76.5.....9/30/2014....9/25/2014....1
.....Chelmsford....24.5.....9/30/2014....9/23/2014....1
.....Chelmsford....14.5.... 9/30/2014....9/22/2014....2
.....Newtonville....48.5....9/30/2014....9/25/2014....1
.....Newtonville......7.....9/30/2014....9/24/2014....2
.....Wakefield.......46.....9/30/2014....9/23/2014....2
.....Harvard........92.5....9/30/2014...9/21/2014.....2
.....N. Reading......27....9/30/2014....9/23/2014.....1
.....N Chelmsford....45....9/30/2014....9/24/2014.....2
.....summary at "Y" "Z"
9/21 9/22 etc
cutter 1
cutter 2
=SUMIF(G3:G11,"="&Y3,C3:C11+SUMIF(F3:F11,"="&Z3,C3:C11)
again, looking for production by cutter (1&2) and also by date cut
Using your first example, enter the cutter in H2; date in I1; and this formula in I2
=SUMIFS($C$2:$C$5,$F$2:$F$5,$H2,$E$2:$E$5,I$1)
With some minor range adjustments you can then drag the formula across and down
Related
I am trying to get a unique rank value (e.g. {1, 2, 3, 4} from a subgroup in my data. SUMPRODUCT will produce ties{1, 1, 3, 4}, I am trying to add the COUNTIFS to the end to adjust the duplicate rank away.
subgroup
col B col M rank
LMN 01 1
XYZ 02
XYZ 02
ABC 03
ABC 01
XYZ 01
LMN 02 3
ABC 01
LMN 03 4
LMN 03 4 'should be 5
ABC 02
XYZ 02
LMN 01 1 'should be 2
So far, I've come up with this.
=SUMPRODUCT(($B$2:$B$38705=B2)*(M2>$M$2:$M$38705))+countifs(B2:B38705=B2,M2:M38705=M2)
What have I done wrong here?
The good news is that you can throw away the SUMPRODUCT function and replace it with a pair of COUNTIFS functions. The COUNTIFS can use full column references without detriment and is vastly more efficient than the SUMPRODUCT even with the SUMPRODUCT cell ranges limited to the extents of the data.
In N2 as a standard function,
=COUNTIFS(B:B, B2,M:M, "<"&M2)+COUNTIFS(B$2:B2, B2, M$2:M2, M2)
Fill down as necessary.
Filtered Results
Solution basing on OP
Studying your post demanding to post any alternatives, I got interested in a solution based on your original approach via the SUMPRODUCT function.
IMO this could show the right way for the sake of the art:
Applied method
Get
a) all current ids with a group value lower or equal to the current value
MINUS
b) the number of current ids with the identical group value starting count from the current row
PLUS
c) the increment of 1
Formula example, e.g. in cell N5:
=SUMPRODUCT(($B$2:$B$38705=$B5)*($M$2:$M$38705<=$M5))-COUNTIFS($B5:$B$38705,$B5,$M5:$M$38705,$M5)+1
P.S.
Of course, I agree with you preferring the above posted solution, too :+)
I have a file which looks like:
E1 32 45 + Apple
E2 54 76 + Apple
...
...
-E2 300 400 + Apple
-E1 540 760 + Apple
E1 560 600 - Orange
E2 340 440 - Orange
...
...
-E2 30 40 - Orange
-E1 20 7 - Orange
Here E for each unique value from last column can range from 1 to 100. And the last column can go till several thousand unique fruits. I want to estimate the average of difference in first E's (E1) from each unique value of last column.
E1 ((45-32)+(600-560))/2 = 26.5
E2 ((76-54)+(440-340))/2 = 61
I want the calculate E1, E2 and E3, and also -E3, -E2, -E1, where -E1 is last E in every unique entry from last column, similarly -E2 and -E3 are second and third last Es.
I tried groupby from pandas to approach this problem:
df1.groupby(str(line[4]))[line[2]-line[1]].mean()
I dont not know whether groupby is the right approach or not, and I am having hard time making a loop for this case. `
I am trying to get a unique rank value (e.g. {1, 2, 3, 4} from a subgroup in my data. SUMPRODUCT will produce ties{1, 1, 3, 4}, I am trying to add the COUNTIFS to the end to adjust the duplicate rank away.
subgroup
col B col M rank
LMN 01 1
XYZ 02
XYZ 02
ABC 03
ABC 01
XYZ 01
LMN 02 3
ABC 01
LMN 03 4
LMN 03 4 'should be 5
ABC 02
XYZ 02
LMN 01 1 'should be 2
So far, I've come up with this.
=SUMPRODUCT(($B$2:$B$38705=B2)*(M2>$M$2:$M$38705))+countifs(B2:B38705=B2,M2:M38705=M2)
What have I done wrong here?
The good news is that you can throw away the SUMPRODUCT function and replace it with a pair of COUNTIFS functions. The COUNTIFS can use full column references without detriment and is vastly more efficient than the SUMPRODUCT even with the SUMPRODUCT cell ranges limited to the extents of the data.
In N2 as a standard function,
=COUNTIFS(B:B, B2,M:M, "<"&M2)+COUNTIFS(B$2:B2, B2, M$2:M2, M2)
Fill down as necessary.
Filtered Results
Solution basing on OP
Studying your post demanding to post any alternatives, I got interested in a solution based on your original approach via the SUMPRODUCT function.
IMO this could show the right way for the sake of the art:
Applied method
Get
a) all current ids with a group value lower or equal to the current value
MINUS
b) the number of current ids with the identical group value starting count from the current row
PLUS
c) the increment of 1
Formula example, e.g. in cell N5:
=SUMPRODUCT(($B$2:$B$38705=$B5)*($M$2:$M$38705<=$M5))-COUNTIFS($B5:$B$38705,$B5,$M5:$M$38705,$M5)+1
P.S.
Of course, I agree with you preferring the above posted solution, too :+)
Some days ago i got help from Scott Craner with an formula for a 3D index match which works great.
I have tried expanding on it without any results, hopefully you can point out what i'm doing wrong.
Output list
Group Division Input Verification Differance
G1 1 120 123 =Sum([#[Input]]-[#[Verification])
G2 2 76 110 =Sum([#[Input]]-[#[Verification])
G3 3 110 90 =Sum([#[Input]]-[#[Verification])
G4 4 34 53 =Sum([#[Input]]-[#[Verification])
Data list
Group Division Year Jan Feb Mar Apr
G1 1 2017 123 95 80
G2 2 2017 110 85 75
G3 3 2017 90 80 70
G4 4 2017 53 53 46
Following code is the one im trying to use, using only Group as a lookup i get a value
=INDEX(DataList,MATCH([#Group]:[#Division],DataList[Group]:DataList[Division],0),MATCH(TEXT($A$1,"mmm"),DataList[#Headers],0))
I have tried different variations,
Binding the results together with an &,
Tried binding just one result with & and the other one with a simple :
nothing has produced a good result in some cases i get a result, in others i do not get anything.
If i only use Group as a lookup term it's not an issue, it returns the correct value, but I'm trying to Index match two cells with two other cells.
I have evaluated the code and it does not return a value and I do not know what i'm doing incorrectly
Ive written a function to calculate what MARK a student gets, based on a scoring table.
Why does my function work only for A mark?
This what the excel sheet looks like
COLUMN: A B C
Student SCORE MARK
1 adsf 90 A
2 asgfd 89 FALSE
3 A 90 100
4 B 81 89
5 C 71 80
6 D 61 70
7 E 56 60
8 Fx 0 55
This is the function:
{=IF(B1>=$B$3:$B$8,IF(B1<=$C$3:$C$8,$A$3:$A$8))}
I'm using {} brackets for array functions. (CTRL SHIFT ENTER)
Thank you
You're on the right track but your formula is returning an array not a single value. Wrapping the result in LOOKUP should give the desired result:
=LOOKUP("Z",IF(B1>=$B$3:$B$8,IF(B1<=$C$3:$C$8,$A$3:$A$8))
This returns the last matching grade since "Z" is larger than any other text value in the range.
A simpler method is:
=LOOKUP(-B1,-C$3:C$8,A$3:A$8)
The negative signs are needed so that the lookup values are in ascending order.