Finding the last cell with value, with multiple criteria

KKaroullas

New Member
Joined
Feb 11, 2018
Messages
1
Hello All,

I need a formula that is able to find to the last value (Excluding 0 and empty cells) and then divide it by the divider next to it.
For example Allan's value must be -0.5 (row 8) because at the row 9 there is a 0.
Brian's value must be -0.06667 because row 20 is zero and row 19 is empty so the value must be tracked in row 18 and then divide it by the Divider. (-0.2/3=-0.06667).
Charles's value is the last row dividing it by the divider.

How can I built such a formula with this criteria?

[TABLE="width: 448"]
<colgroup><col width="64" span="7" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"]Name[/TD]
[TD="class: xl65, width: 64"]Divider[/TD]
[TD="class: xl65, width: 64"]Value[/TD]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]-1.4[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]-1.7[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]-0.4[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]-0.1[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]6[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]7[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]-0.3[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]8[/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]1[/TD]
[TD="class: xl65"]-0.5[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]9[/TD]
[TD="class: xl66"]Allan[/TD]
[TD="class: xl66"]1[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"]Allan[/TD]
[TD="class: xl65"]-0.5[/TD]
[/TR]
[TR]
[TD="class: xl65"]
10[/TD]
[TD="class: xl65"]
Brian[/TD]
[TD="class: xl65"]
11 [/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]11[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]8[/TD]
[TD="class: xl65"]-2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]12[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]6[/TD]
[TD="class: xl65"]-0.6[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]13[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]-0.1[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]14[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]-1.2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]15[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]-1.6[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]16[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]17[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]-1.56667[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]18[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]-0.2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]19[/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]20[/TD]
[TD="class: xl66"]Brian[/TD]
[TD="class: xl66"]2[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"]Brian[/TD]
[TD="class: xl65"]-0.06667[/TD]
[/TR]
[TR]
[TD="class: xl65"]
21
[/TD]
[TD="class: xl65"]
Charles[/TD]
[TD="class: xl65"]
8[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]22[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]7[/TD]
[TD="class: xl65"]0.1[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]23[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]-0.4[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]24[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]5[/TD]
[TD="class: xl65"]-0.83333[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]25[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]4[/TD]
[TD="class: xl65"]-0.8[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]26[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]-0.8[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]27[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]3[/TD]
[TD="class: xl65"]-0.8[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]28[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]-2.2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]29[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]-5.4[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]30[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]-1.4[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
[TR]
[TD="class: xl65"]31[/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]2[/TD]
[TD="class: xl65"]-2[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"]Charles[/TD]
[TD="class: xl65"]-1[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the MrExcel board!

Try these, copied down.


Book1
ABCDEF
1NameDividerValue
2Allan5-1.4  
3Allan4-1.7
4Allan3-0.4
5Allan2-0.1
6Allan20
7Allan2
8Allan2-0.3
9Allan1-0.5
10Allan10Allan-0.5
11Brian11
12Brian8-2
13Brian6-0.6
14Brian5-0.1
15Brian5-1.2
16Brian5-1.6
17Brian4
18Brian3-1.56667
19Brian3-0.2
20Brian2
21Brian20Brian-0.066666667
22Charles8
23Charles70.1
24Charles5-0.4
25Charles5-0.83333
26Charles4-0.8
27Charles3-0.8
28Charles3-0.8
29Charles2-2.2
30Charles2-5.4
31Charles2-1.4
32Charles2-2Charles-1
Last Value
Cell Formulas
RangeFormula
E2=IF(A2=A3,"",A2)
F2=IF(E2="","",INDEX(C$2:C2,AGGREGATE(14,6,(ROW(C$2:C2)-ROW(C$2)+1)/((A$2:A2=A2)*(C$2:C2<>0)),1))/INDEX(B$2:B2,AGGREGATE(14,6,(ROW(C$2:C2)-ROW(C$2)+1)/((A$2:A2=A2)*(C$2:C2<>0)),1)))
 
Upvote 0
E2 like Peter suggests...

=IF(A2=A3,"",A2)

In F2 enter and copy down:

=IF($E2="","",LOOKUP(9.99E+307,1/($A$2:$A$32=$A2)/$C$2:$C$32,$C$2:$C$32/$B$2:$B$32))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top