Find Last value in a Row

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
695
Office Version
  1. 2019
Platform
  1. Windows
Hello,
Looking to find the last cell value in a Row for a specific lookup value (A9:A15). The Rows of the lookup value will change due to sorting by G/L.
ie Last cell value for TECL, FNGG, SOXL to find the last cell value in a Row. If I could extend the range to U9:ZZ15, for an unlimited range number to find the last value.
Thank you.

The Whole Enchilada.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
7SCHWAB# ofShort vsSold
8 Symbol Sector Type Shares Price CURRENT MAX Value MIN Value CostBalanceG/L $G/L %Weight(%)Buy DateDaysLong TermCap Gain %Cap Ga CostAdj GainStatus8/19/20238/26/20239/2/20239/9/20239/16/20239/23/20239/30/202310/7/202310/14/202310/21/2023
9TECLTech 3xLong45$24.10$47.02#N/A#N/A$1,084.50$2,115.90$1,031.4095.10%#DIV/0!9/23/22388Long0%$0.00$1,031.40open61.16%71.43%94.11%82.64%69.82%56.81%54.83%66.55%92.95%95.10%
10SOXLSemis 3xLong98$20.40$19.40#N/A#N/A$1,999.20$1,901.20-$98.00-4.90%#DIV/0!10/10/236Short10%$0.00-$98.00open-6.96%-4.90%
11FNGGFANGs 2xLong27$77.07$71.89#N/A#N/A$2,080.89$1,941.03-$139.86-6.72%#DIV/0!7/25/2383Short10%$0.00-$139.86open-15.26%-10.82%-0.17%-1.63%-3.92%-13.04%-12.14%-6.11%-7.69%-6.72%
12
13
14
15              
16
17?????????
18MaxMinFirstLastMaxMinFirstLastMaxMinFirstLast
1995.10%54.83%61.16%???-0.17%-15.26%-15.26%???-4.90%-6.96%-6.96%???
20TECLTECLFNGGFNGGSOXLSOXL
21#VALUE!#VALUE!#VALUE!
22Weekly DiffWeekly DiffWeekly Diff
232.16%0.97%2.06%
Sheet1
Cell Formulas
RangeFormula
F15,F9:F11F9=IF(ISTEXT($A9),VLOOKUP($A9,'All Tickers'!$I$1:$J$202,2,0),"")
G15,G9:G11G9=IF(ISBLANK($A9),"",IF($F9=0,0,MAX($F9,$G9)))
H15,H9:H11H9=IF(ISBLANK($A9),"",IF($H9=0,$F9,MEDIAN($H9,$F9,0)))
I15,I9:I11I9=IF($A9="","",D9*E9)
J15,J9:J11J9=IF($A9="","",$D9*$F9)
K15,K9:K11K9=IF($A9="","",J9-I9)
L9L9=IF($A9="","",($J9-$I9)/$I9)
M15,M9:M11M9=IF($A9="","",J9/$J$16)
L15,L10:L11L10=IF($A10="","",K10/I10)
O15,O9:O11O9=IF(A9="","",TODAY()-N9)
P15,P9:P11P9=IF(ISNUMBER($N9),IF(DATEDIF($N9,TODAY(),"d")<365,"Short","Long"),"")
Q15,Q9:Q11Q9=IF(ISTEXT($A9),IF(TODAY()-N9>365,0,0.1),"")
R15,R9:R11R9=IF(ISTEXT($A9),IF(K9>0,K9*Q9,0),"")
S15,S9:S11S9=IF(ISTEXT($A9),IF($K9=0,"$0",$K9-$R9),"")
B15,B9:B11B9=IF(COUNTIF(Sectors!$A$2:$ABW$47,$A9)=1,INDEX(Sectors!$A$2:$ABW$2,MAX((Sectors!$A$2:$ABW$47=$A9)*(COLUMN(Sectors!$A$2:$ABW$2)))),"")
AD8AD8=AC8+7
AD9:AD11AD9=$L9
U19,AC19,Y19U19=MAX(INDEX($U$9:$ZZ$15,MATCH(U20,$A$9:$A$15,),))
V19,AD19,Z19V19=MIN(INDEX($U$9:$ZZ$15,MATCH(U20,$A$9:$A$15,),))
W19,AA19W19=INDEX($U$9:$U$15,MATCH(U20,$A$9:$A$15,0))
W21,AE21,AA21W21=X19-W19
W23W23=LOOKUP(2, 1/($A$9:$ZX$9<>""), $A$9:$ZX$9)-INDEX(9:9, AGGREGATE(14, 6, COLUMN(A:ZX)/(A9:ZX9<>""), 2))
AA23AA23=LOOKUP(2, 1/($A$11:$ZX$11<>""), $A$11:$ZX$11)-INDEX(11:11, AGGREGATE(14, 6, COLUMN(A:ZX)/(A11:ZX11<>""), 2))
AE23AE23=LOOKUP(2, 1/($A$10:$ZX$10<>""), $A$10:$ZX$10)-INDEX(10:10, AGGREGATE(14, 6, COLUMN(C:ZZ)/(C10:ZZ10<>""), 2))
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hello,
Looking to find the last cell value in a Row for a specific lookup value (A9:A15). The Rows of the lookup value will change due to sorting by G/L.
ie Last cell value for TECL, FNGG, SOXL to find the last cell value in a Row. If I could extend the range to U9:ZZ15, for an unlimited range number to find the last value.
Thank you.

The Whole Enchilada.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
7SCHWAB# ofShort vsSold
8 Symbol Sector Type Shares Price CURRENT MAX Value MIN Value CostBalanceG/L $G/L %Weight(%)Buy DateDaysLong TermCap Gain %Cap Ga CostAdj GainStatus8/19/20238/26/20239/2/20239/9/20239/16/20239/23/20239/30/202310/7/202310/14/202310/21/2023
9TECLTech 3xLong45$24.10$47.02#N/A#N/A$1,084.50$2,115.90$1,031.4095.10%#DIV/0!9/23/22388Long0%$0.00$1,031.40open61.16%71.43%94.11%82.64%69.82%56.81%54.83%66.55%92.95%95.10%
10SOXLSemis 3xLong98$20.40$19.40#N/A#N/A$1,999.20$1,901.20-$98.00-4.90%#DIV/0!10/10/236Short10%$0.00-$98.00open-6.96%-4.90%
11FNGGFANGs 2xLong27$77.07$71.89#N/A#N/A$2,080.89$1,941.03-$139.86-6.72%#DIV/0!7/25/2383Short10%$0.00-$139.86open-15.26%-10.82%-0.17%-1.63%-3.92%-13.04%-12.14%-6.11%-7.69%-6.72%
12
13
14
15              
16
17?????????
18MaxMinFirstLastMaxMinFirstLastMaxMinFirstLast
1995.10%54.83%61.16%???-0.17%-15.26%-15.26%???-4.90%-6.96%-6.96%???
20TECLTECLFNGGFNGGSOXLSOXL
21#VALUE!#VALUE!#VALUE!
22Weekly DiffWeekly DiffWeekly Diff
232.16%0.97%2.06%
Sheet1
Cell Formulas
RangeFormula
F15,F9:F11F9=IF(ISTEXT($A9),VLOOKUP($A9,'All Tickers'!$I$1:$J$202,2,0),"")
G15,G9:G11G9=IF(ISBLANK($A9),"",IF($F9=0,0,MAX($F9,$G9)))
H15,H9:H11H9=IF(ISBLANK($A9),"",IF($H9=0,$F9,MEDIAN($H9,$F9,0)))
I15,I9:I11I9=IF($A9="","",D9*E9)
J15,J9:J11J9=IF($A9="","",$D9*$F9)
K15,K9:K11K9=IF($A9="","",J9-I9)
L9L9=IF($A9="","",($J9-$I9)/$I9)
M15,M9:M11M9=IF($A9="","",J9/$J$16)
L15,L10:L11L10=IF($A10="","",K10/I10)
O15,O9:O11O9=IF(A9="","",TODAY()-N9)
P15,P9:P11P9=IF(ISNUMBER($N9),IF(DATEDIF($N9,TODAY(),"d")<365,"Short","Long"),"")
Q15,Q9:Q11Q9=IF(ISTEXT($A9),IF(TODAY()-N9>365,0,0.1),"")
R15,R9:R11R9=IF(ISTEXT($A9),IF(K9>0,K9*Q9,0),"")
S15,S9:S11S9=IF(ISTEXT($A9),IF($K9=0,"$0",$K9-$R9),"")
B15,B9:B11B9=IF(COUNTIF(Sectors!$A$2:$ABW$47,$A9)=1,INDEX(Sectors!$A$2:$ABW$2,MAX((Sectors!$A$2:$ABW$47=$A9)*(COLUMN(Sectors!$A$2:$ABW$2)))),"")
AD8AD8=AC8+7
AD9:AD11AD9=$L9
U19,AC19,Y19U19=MAX(INDEX($U$9:$ZZ$15,MATCH(U20,$A$9:$A$15,),))
V19,AD19,Z19V19=MIN(INDEX($U$9:$ZZ$15,MATCH(U20,$A$9:$A$15,),))
W19,AA19W19=INDEX($U$9:$U$15,MATCH(U20,$A$9:$A$15,0))
W21,AE21,AA21W21=X19-W19
W23W23=LOOKUP(2, 1/($A$9:$ZX$9<>""), $A$9:$ZX$9)-INDEX(9:9, AGGREGATE(14, 6, COLUMN(A:ZX)/(A9:ZX9<>""), 2))
AA23AA23=LOOKUP(2, 1/($A$11:$ZX$11<>""), $A$11:$ZX$11)-INDEX(11:11, AGGREGATE(14, 6, COLUMN(A:ZX)/(A11:ZX11<>""), 2))
AE23AE23=LOOKUP(2, 1/($A$10:$ZX$10<>""), $A$10:$ZX$10)-INDEX(10:10, AGGREGATE(14, 6, COLUMN(C:ZZ)/(C10:ZZ10<>""), 2))
Press CTRL+SHIFT+ENTER to enter array formulas.
I found a solution:
Use Match to find the Row# for each symbol.
MATCH(W20,A:A,0) for "TECL"
and
INDIRECT for the Column reference

Original Formula for "Last" value: LOOKUP(2, 1/($A$9:$ZZ$9<>""), $A$9:$ZZ$9)
New Formula for "Last" value: LOOKUP(2,1/(INDIRECT("A"&MATCH(W20,A:A,0))*INDIRECT("ZZ"&MATCH(W20,A:A,0)))<>"")*(INDIRECT("A"&MATCH(W20,A:A,0))*INDIRECT("ZZ"&MATCH(W20,A:A,0)))))

$A$9 (both references) = (INDIRECT("A"&MATCH(W20,A:A,0))
$ZZ$9 (first reference) = (INDIRECT("ZZ"&MATCH(W20,A:A,0)))<>"")
$ZZ$9 (second reference) = (INDIRECT("ZZ"&MATCH(W20,A:A,0))))
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,084
Members
453,021
Latest member
Justyna P

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