Hello Armagan
To get the desired results, the chosen month has to be 1 (january) and not 2.
<table valign="middle" colspan="7" style="font-family: Calibri; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 11px; font-weight: bold; font-style: normal;" border="1" cellpadding="2" cellspacing="0"><colgroup><col width="28pt"><col width="60pt"><col width="60pt"><col width="60pt"><col width="60pt"><col width="60pt"><col width="66pt"></colgroup><tbody><tr style="background-color: rgb(250, 250, 250);"><td colspan="7" align="middle">Worksheet 'trades'</td></tr><tr style="background-color: rgb(202, 202, 202);"><td>
</td><td align="middle">A</td><td align="middle">B</td><td align="middle">C</td><td align="middle">D</td><td align="middle">E</td><td align="middle">F</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">1</td><td style="font-family: Verdana; font-size: 10px;" align="left">Stock</td><td style="font-family: Verdana; font-size: 10px;" align="left">date</td><td style="font-family: Verdana; font-size: 10px;" align="left">price</td><td style="font-family: Verdana; font-size: 10px;" align="left">quantity</td><td style="font-family: Verdana; font-size: 10px;" align="left">cost</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="right">1</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">2</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Rio Tinto</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">01.12.2010</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">5</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">2</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">10</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">
</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">3</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Shell</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">23.12.2010</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">3</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">1</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">3</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">
</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">4</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Barclays</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">01.01.2011</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">2</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">4</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">8</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">financial</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">5</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Shell 2</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">13.01.2011</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">3</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">3</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">9</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">industrial</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">6</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Shell 3</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">17.01.2011</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">2</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">4</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">8</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">industrial</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">7</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Rio Tinto 2</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">23.02.2011</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">5</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">1</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">5</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">
</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">8</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="left">Shell 4</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">03.03.2011</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">3</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">1</td><td style="font-family: Verdana; font-size: 10px; font-weight: normal;" align="right">3</td><td style="color: rgb(255, 0, 0); font-weight: normal;" align="left">
</td></tr></tbody></table>
<table valign="middle" colspan="2" style="table-layout: auto; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri; font-size: 10px;" border="3" cellpadding="2" cellspacing="0"><colgroup><col width="40pt"><col></colgroup><tbody><tr style="background-color: rgb(238, 170, 170);"><td>Cell</td><td>Formula</td></tr><tr><td>F2</td><td>=IF(MONTH(B2)=$F$1,VLOOKUP(IF(ISNUMBER(--RIGHT(A2,1)),LEFT(A2,LEN(A2)-2),A2),holdings!A:B,2,FALSE),"")</td></tr></tbody></table><table style="font-family: Arial; font-size: 7pt;"><tbody><tr><td style="color: rgb(51, 51, 51);">Created with Tab2HTML (v2.4.1). ©Gerd alias Bamberg</td></tr></tbody></table>
<table valign="middle" colspan="6" style="font-family: Calibri; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 11px; font-weight: bold; font-style: normal;" border="1" cellpadding="2" cellspacing="0"><colgroup><col width="28pt"><col width="60pt"><col width="60pt"><col width="60pt"><col width="60pt"><col width="60pt"></colgroup><tbody><tr style="background-color: rgb(250, 250, 250);"><td colspan="6" align="middle">Worksheet 'industrial'</td></tr><tr style="background-color: rgb(202, 202, 202);"><td>
</td><td align="middle">A</td><td align="middle">B</td><td align="middle">C</td><td align="middle">D</td><td align="middle">E</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">1</td><td style="font-family: Verdana; font-size: 10px;" align="left">Stock</td><td style="font-family: Verdana; font-size: 10px;" align="left">date</td><td style="font-family: Verdana; font-size: 10px;" align="left">price</td><td style="font-family: Verdana; font-size: 10px;" align="left">quantity</td><td style="font-family: Verdana; font-size: 10px;" align="left">cost</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">2</td><td style="font-weight: normal;" align="left">Shell 2</td><td style="font-weight: normal;" align="right">13.01.2011</td><td style="font-weight: normal;" align="right">3</td><td style="font-weight: normal;" align="right">3</td><td style="font-weight: normal;" align="right">9</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">3</td><td style="font-weight: normal;" align="left">Shell 3</td><td style="font-weight: normal;" align="right">17.01.2011</td><td style="font-weight: normal;" align="right">2</td><td style="font-weight: normal;" align="right">4</td><td style="font-weight: normal;" align="right">8</td></tr><tr><td style="background-color: rgb(202, 202, 202);" align="middle">4</td><td style="font-weight: normal;" align="left">
</td><td style="font-weight: normal;" align="left">
</td><td style="font-weight: normal;" align="left">
</td><td style="font-weight: normal;" align="left">
</td><td style="font-weight: normal;" align="left">
</td></tr></tbody></table>
<table valign="middle" colspan="2" style="table-layout: fixed; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri; font-size: 10px;" border="3" cellpadding="2" cellspacing="0"><colgroup><col width="40pt"><col></colgroup><tbody><tr style="background-color: rgb(238, 170, 170);"><td>Cell</td><td>Formula</td></tr><tr><td>A2</td><td>{=IF(COUNTIF(trades!$F$2:$F$10,"industrial")<ROWS(A$2:A2),"",INDEX(trades!A$2:A$10,SMALL(IF(trades!$F$2:$F$10="industrial",ROW(trades!A$2:A$10)-ROW(trades!A$2)+1),ROWS(A$2:A2))))}</td></tr></tbody></table><table style="font-family: Arial; font-size: 8pt; background-color: rgb(255, 255, 255);"><tbody><tr><td style="font-weight: bold;">Contains array formula!</td></tr><tr><td>Do not enter the curly brackets {}.
</td></tr><tr><td>Enter the formula with CTRL-SHIFT-ENTER instead of just ENTER.</td></tr></tbody></table><table style="font-family: Arial; font-size: 7pt;"><tbody><tr><td style="color: rgb(51, 51, 51);">Created with Tab2HTML (v2.4.1). ©Gerd alias Bamberg</td></tr></tbody></table>