Reference from first and last values in a row

lbird2

Board Regular
Joined
Dec 10, 2014
Messages
51
Start Date
End Date
Jan-20
Feb-20
Mar-20
Apr-20
May-20
Jun-20
Jul-20
A
212
518
623
B
891
218
563
500
C
926
777

<tbody>
</tbody>

For the table above, I would like to return the dates corresponding to the first and last values in the row.
For example, Start Date for category A would Feb-20, End Date Apr-20.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
8,893
Office Version
2007
Platform
Windows
Try this array formulas

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td><td >H</td><td >I</td><td >J</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td > </td><td >Start Date</td><td >End Date</td><td style="text-align:right; ">ene-20</td><td style="text-align:right; ">feb-20</td><td style="text-align:right; ">mar-20</td><td style="text-align:right; ">abr-20</td><td style="text-align:right; ">may-20</td><td style="text-align:right; ">jun-20</td><td style="text-align:right; ">jul-20</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >A</td><td style="text-align:right; ">feb-20</td><td style="text-align:right; ">abr-20</td><td > </td><td style="text-align:right; ">212</td><td style="text-align:right; ">518</td><td style="text-align:right; ">623</td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >B</td><td style="text-align:right; ">abr-20</td><td style="text-align:right; ">jul-20</td><td > </td><td > </td><td > </td><td style="text-align:right; ">891</td><td style="text-align:right; ">218</td><td style="text-align:right; ">563</td><td style="text-align:right; ">500</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >C</td><td style="text-align:right; ">ene-20</td><td style="text-align:right; ">feb-20</td><td style="text-align:right; ">926</td><td style="text-align:right; ">777</td><td > </td><td > </td><td > </td><td > </td><td > </td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Array Formula</td></tr><tr><td >B2</td><td >{=INDEX($A$1:$J$1,0,MIN(IF($D2:$J2>0,COLUMN($D2:$J2))))}</td></tr><tr><td >C2</td><td >{=INDEX($A$1:$J$1,0,MAX(IF($D2:$J2>0,COLUMN($D2:$J2))))}</td></tr></table></td></tr></table>

Array formulas
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,317
Office Version
365
Platform
Windows
How about

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th><th>I</th><th>J</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;"></td><td style=";">Start Date</td><td style=";">End Date</td><td style="text-align: center;;">Jan-20</td><td style="text-align: center;;">Feb-20</td><td style="text-align: center;;">Mar-20</td><td style="text-align: center;;">Apr-20</td><td style="text-align: center;;">May-20</td><td style="text-align: center;;">Jun-20</td><td style="text-align: center;;">Jul-20</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">A</td><td style="text-align: right;;">Feb-20</td><td style="text-align: right;;">Apr-20</td><td style="text-align: center;;"></td><td style="text-align: center;;">212</td><td style="text-align: center;;">518</td><td style="text-align: center;;">623</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">B</td><td style="text-align: right;;">Apr-20</td><td style="text-align: right;;">Jul-20</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;">891</td><td style="text-align: center;;">218</td><td style="text-align: center;;">563</td><td style="text-align: center;;">500</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">C</td><td style="text-align: right;;">Jan-20</td><td style="text-align: right;;">Feb-20</td><td style="text-align: center;;">926</td><td style="text-align: center;;">777</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Lookup</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B2</th><td style="text-align:left">=AGGREGATE(<font color="Blue">15,6,$D$1:$J$1/(<font color="Red">D2:J2>0</font>),1</font>)</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">C2</th><td style="text-align:left">=AGGREGATE(<font color="Blue">14,6,$D$1:$J$1/(<font color="Red">D2:J2>0</font>),1</font>)</td></tr></tbody></table></td></tr></table><br />
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
8,893
Office Version
2007
Platform
Windows
I'm glad to help you. Thanks for the feedback.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,317
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,082,316
Messages
5,364,483
Members
400,802
Latest member
RichBRich

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top