To sum the third column (numbers o companies) I've used this
=SUM(1/COUNTIF(Names;Names))
Names is name of array in C column and CTRL+SHIFT+ENTER and it works perfectly.
Now I'd like to sum earnings but only for each company once and with the latest data. For example, the result shoud be like this
=C4+C6+C7+C8+C9+C10
(93)
Thanks
A B C D
1 # company earnings date
2 1 ISB 12 10/11/2011
3 2 DTN 15 11/11/2011
4 3 ABC 13 12/11/2011
5 4 ISB 17 13/11/2011
6 5 RTV 18 14/11/2011
7 6 DTN 22 15/11/2011
8 7 PVS 11 16/11/2011
9 8 ISB 19 17/11/2011
10 9 ANH 10 18/11/2011
Sum 6 93
Assuming ascending dates, you could try with CTRL+SHIFT+ENTER in C11:
=SUM((MAX(A2:A10)-MATCH(B2:B10,LOOKUP(MAX(A2:A10)-A2:A10,A2:A10-1,B2:B10),0)=A2:A10-1)*C2:C10)
I'd suggest using a helper column as the easiest approach. In E2 use this formula
=IF(COUNTIF(B2:B$1000,B2)=1,C2,"")
and copy down the column. Now sum column D for the required answer.
Note that the above formula assumes 1000 rows of data maximum, increase if required.
Related
I have the following table
Name
Point
Bonus
Total
Pos
1st
Name
2nd
Name
Bob
10
8
6
Point
11
10
Sue
9
5
3
Bonus
12
9
Joe
11
2
4
Total
10
7
Susan
7
9
10
Tim
1
12
4
Ellie
9
8
7
In G2 I have the following formula
{=LARGE(IF($B$1:$D$1 =$F2, $B:$D),1)}
Which returns the largest Point value, as 11.
In H2 I want to return the name where the Point value is 11. so the value for H2 should be Joe
Then in J2 want to do the same for the 2nd largest value. So the value of J2 should be Bob
I have used following formulas as per attached scheenshot.
G2=LARGE(INDEX($B$2:$D$7,,MATCH(F2,$B$1:$D$1,0)),1)
H2=INDEX($A$2:$A$7,MATCH(G2,INDEX($B$2:$D$7,,MATCH(F2,$B$1:$D$1,0)),0))
I2=LARGE(INDEX($B$2:$D$7,,MATCH(F2,$B$1:$D$1,0)),2)
J2=INDEX($A$2:$A$7,MATCH(I2,INDEX($B$2:$D$7,,MATCH(F2,$B$1:$D$1,0)),0))
And if you have Microsoft-365 then could try below formula to get names directly.
=LET(x,FILTER($B$2:$D$7,$B$1:$D$1=F2),FILTER($A$2:$A$7,x=LARGE(x,1)))
I am given sales data as per "sheet 1" below. Each row contains the quarter, the product, the region ID, and the sales figure. Each region can have multiple IDs, and I have a lookup table (sheet 2) which denote which region each ID belongs to.
My goal is to get to sheet 3. Essentially I am trying to write a formula that will reference the product name in column A, the quarter in cell A1 (which the user will input), and aggregate the relevant sales figures under each region in column B.
I have tried nesting an INDEX & MATCH function within a SUMIFS within a SUMPRODUCT as per below, but I am getting a #VALUE! error:
=SUMPRODUCT(SUMIFS(INDEX(sheet1!$D:$D$,MATCH(1,($A4=sheet1!$B:$B)*($A$1=Sheet1!$A:$A),0),0),sheet1$C:$C,sheet2!$A$2:$A$8)*(sheet2!$B$2:$B$8=$B4))
Does anyone know what is wrong with my formula, or if there is a better approach to this problem?
Sheet 1 (Raw data)
A
B
C
D
1
Quarter
Product
ID
2021 Sales
2
Q1
A
1
39
3
Q1
A
3
41
4
Q1
A
7
20
5
Q1
A
14
7
6
Q1
A
25
2
7
Q1
A
27
2
8
Q1
A
44
45
9
Q1
B
1
28
10
Q1
B
3
34
11
Q1
B
7
29
12
Q1
B
14
48
13
Q1
B
25
5
14
Q1
B
27
15
15
Q1
B
44
32
16
Q2
A
1
19
17
Q2
A
3
28
and so forth…
Sheet 2 (region ID lookup table)
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
Sheet 3 (Report)
A
B
C
1
Q1
2
3
Product
Region
Sales
4
A
East
29
5
A
Central
42
6
A
West
31
A little rework:
=SUMPRODUCT(SUMIFS(Sheet1!D:D,Sheet1!C:C,IF(Sheet2!$B$2:$B$8=$B4,Sheet2!$A$2:$A$8),Sheet1!A:A,$A$1,Sheet1!B:B,A4))
Depending on version one may need to confirm with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
With the dynamic array formula FILTER we can replace the IF() part with FILTER():
=SUMPRODUCT(SUMIFS(Sheet1!D:D,Sheet1!C:C,FILTER(Sheet2!$A$2:$A$8,Sheet2!$B$2:$B$8=$B4),Sheet1!A:A,$A$1,Sheet1!B:B,A4))
And it will save a few iterations.
I am having an issue with vlookup using 2 columns. I have the following 2 columns in my base excel sheet
ID_1 ID2
2 4
7 9
and my target sheet has these values
ID spend
2 20
4 30
7 10
1 5
9 10
When I run my vlookup, I would like to get this result
ID_1 ID2 Total_Spend
2 4 50
7 9 20
I am using something like this for Total_Spend, but it is not working..
=iferror(vlookup,0)+iferror(vlookup,0)
In this case you can use SUMIF()
Here the formula in D4 is:
=SUMIF($B$9:$B$13,B4,$C$9:$C$13)+SUMIF($B$9:$B$13,C4,$C$9:$C$13)
I have this columns in excel:
A B C D E F
Nima1 1 2 3 4 5
Nima2 6 7 8 9 10
Nima3 11 12 13 14 15
Nima4 16 17 18 19 20
and I want to show them like this:
Nima1 1
Nima1 2
Nima1 3
Nima1 4
Nima1 5
Nima2 6
…
Nima4 20
and so far I come up with nothing, every formula that I write doesn't work.
please if anyone knows how to do it, guide me through it.
In any unused cell to the right put in this formula,
'for system that use a comma as a list separator
=INDEX(A:E,(ROW(1:1)-1)/5+1,IF(COLUMN(A:A)=1,1,MOD(ROW(1:1)-1,5)+1))
'for system that use a semi-colon as a list separator
=INDEX(A:E;(ROW(1:1)-1)/5+1;IF(COLUMN(A:A)=1;1;MOD(ROW(1:1)-1;5)+1))
Fill right one column then fill both down until you get zeroes.
In Excel I am trying to allocate classes to pupils based on their ranking in school. The set of data I have looks like this:
S/N Name LevelPosition
1 Andrea 10
2 Bryan 25
3 Catty 5
4 Debbie 26
5 Ellie 30
6 Freddie 28
I would like to have a formula that could sort the pupils based on the LevelPosition and allocate the class in order of this sequence - A,B,C,C,B,A. Hence the result would be:
S/N Name LevelPosition AllocatedClass
3 Catty 5 A
1 Andrea 10 B
2 Bryan 25 C
4 Debbie 26 C
6 Freddie 28 B
5 Ellie 30 A
This was the sort of thing I had in mind.
Column D is just a ranking from bottom to top:-
=RANK(C2,C$2:C$7,1)
Colum D is adjusted for any ties:-
=D2+COUNTIF(D$1:D1,D2)
Column E is based on the #pnuts formula:-
=CHOOSE(MOD(E2-1,6)+1,"A","B","C","C","B","A")
I've put some ties in to show what would happen. The last two students' allocations are reversed because the second to last has the higher mark.