Excel formula to find the nearest values - excel

Is it possible to find the nearest value (+or-) with formula and display the 1st row value & 1st column value in my linked excel table?
Eg:
Search Value is "7,30" (C12; variable can ask for any value on table)
Found row value is "7" (E12 with formula; adressed to A7)
Found column value "4,00%" (E13 with formula; adressed to E1)
"F12" Formula is OK. What can be the formula in "F13" regarding the information on table below?
<head>
<meta http-equiv=Content-Type content="text/html; charset=Windows-1254">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 14">
<link rel=File-List href="SampleT_dosyalar/filelist.xml">
<style id="table-3_9841_Styles">
<!--table
{mso-displayed-decimal-separator:"\,";
mso-displayed-thousand-separator:"\.";}
.xl159841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl659841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:right;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl669841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl679841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:Fixed;
text-align:general;
vertical-align:bottom;
border:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl689841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:"0\.00\\%";
text-align:general;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl699841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
background:#FFC000;
mso-pattern:black none;
white-space:nowrap;}
.xl709841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:"0\.00\\%";
text-align:general;
vertical-align:bottom;
background:#FFC000;
mso-pattern:black none;
white-space:nowrap;}
.xl719841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:"0\.00\\%";
text-align:general;
vertical-align:bottom;
border:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl729841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:left;
vertical-align:top;
border:none;
mso-diagonal-up:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl739841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:red;
font-size:11.0pt;
font-weight:700;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl749841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:#0070C0;
font-size:11.0pt;
font-weight:700;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl759841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:center;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl769841
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:162;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
background:#D9D9D9;
mso-pattern:black none;
white-space:nowrap;}
-->
</style>
</head>
<body>
<!--[if !excel]> <![endif]-->
<!--Aşağıdaki bilgiler Microsoft Excel'in Web Sayfası Olarak Yayımlama
sihirbazı tarafından oluşturuldu.-->
<!--Aynı öğe Excel'den yeniden yayımlanırsa, DIV etiketleri arasındaki
bilgilerin tümü değiştirilecek.-->
<!----------------------------->
<!--EXCEL WEB SAYFASI OLARAK YAYIMLA SİHİRBAZI ÇIKTI BAŞLANGICI-->
<!----------------------------->
<div id="table-3_9841" align=center x:publishsource="Excel">
<table border=0 cellpadding=0 cellspacing=0 width=1114 style='border-collapse:
collapse;table-layout:fixed;width:836pt'>
<col class=xl159841 width=26 style='mso-width-source:userset;mso-width-alt:
950;width:20pt'>
<col class=xl159841 width=64 style='width:48pt'>
<col width=64 span=16 style='width:48pt'>
<tr class=xl159841 height=20 style='height:15.0pt'>
<td height=20 class=xl769841 width=26 style='height:15.0pt;width:20pt'> </td>
<td class=xl759841 width=64 style='width:48pt'>A</td>
<td class=xl759841 width=64 style='width:48pt'>B</td>
<td class=xl759841 width=64 style='width:48pt'>C</td>
<td class=xl759841 width=64 style='width:48pt'>D</td>
<td class=xl759841 width=64 style='width:48pt'>E</td>
<td class=xl759841 width=64 style='width:48pt'>F</td>
<td class=xl759841 width=64 style='width:48pt'>H</td>
<td class=xl759841 width=64 style='width:48pt'>I</td>
<td class=xl759841 width=64 style='width:48pt'>J</td>
<td class=xl759841 width=64 style='width:48pt'>K</td>
<td class=xl759841 width=64 style='width:48pt'>L</td>
<td class=xl759841 width=64 style='width:48pt'>M</td>
<td class=xl759841 width=64 style='width:48pt'>N</td>
<td class=xl759841 width=64 style='width:48pt'>O</td>
<td class=xl759841 width=64 style='width:48pt'>P</td>
<td class=xl759841 width=64 style='width:48pt'>Q</td>
<td class=xl759841 width=64 style='width:48pt'>R</td>
</tr>
<tr height=20 style='mso-height-source:userset;height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>1</td>
<td rowspan=2 class=xl729841 width=64 style='width:48pt'><span
style='mso-spacerun:yes'> </span>%<br>
<span style='mso-spacerun:yes'> </span>Price</td>
<td class=xl689841 align=right>1,00%</td>
<td class=xl689841 align=right>2,00%</td>
<td class=xl689841 align=right>3,00%</td>
<td class=xl709841 align=right>4,00%</td>
<td class=xl689841 align=right>5,00%</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>2</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>3</td>
<td class=xl159841 align=right>3</td>
<td class=xl159841 align=right><a name="RANGE!C4:G11">3,03</a></td>
<td class=xl159841 align=right>3,06</td>
<td class=xl159841 align=right>3,095</td>
<td class=xl159841 align=right>3,125</td>
<td class=xl159841 align=right>3,16</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>4</td>
<td class=xl159841 align=right>4</td>
<td class=xl159841 align=right>4,04</td>
<td class=xl159841 align=right>4,08</td>
<td class=xl159841 align=right>4,125</td>
<td class=xl159841 align=right>4,165</td>
<td class=xl159841 align=right>4,21</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>5</td>
<td class=xl159841 align=right>5</td>
<td class=xl159841 align=right>5,05</td>
<td class=xl159841 align=right>5,1</td>
<td class=xl159841 align=right>5,155</td>
<td class=xl159841 align=right>5,21</td>
<td class=xl159841 align=right>5,265</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>6</td>
<td class=xl159841 align=right>6</td>
<td class=xl159841 align=right>6,06</td>
<td class=xl159841 align=right>6,12</td>
<td class=xl159841 align=right>6,185</td>
<td class=xl159841 align=right>6,25</td>
<td class=xl739841 align=right>7,29</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>7</td>
<td class=xl699841 align=right>7</td>
<td class=xl159841 align=right>7,07</td>
<td class=xl159841 align=right>7,145</td>
<td class=xl159841 align=right>7,215</td>
<td class=xl739841 align=right>7,29</td>
<td class=xl159841 align=right>7,37</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>8</td>
<td class=xl159841 align=right>8</td>
<td class=xl159841 align=right>8,08</td>
<td class=xl159841 align=right>8,165</td>
<td class=xl159841 align=right>8,245</td>
<td class=xl159841 align=right>8,335</td>
<td class=xl159841 align=right>8,42</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>9</td>
<td class=xl159841 align=right>9</td>
<td class=xl159841 align=right>9,09</td>
<td class=xl159841 align=right>9,185</td>
<td class=xl159841 align=right>9,28</td>
<td class=xl159841 align=right>9,375</td>
<td class=xl159841 align=right>9,475</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>10</td>
<td class=xl159841 align=right>10</td>
<td class=xl159841 align=right>10,1</td>
<td class=xl159841 align=right>10,205</td>
<td class=xl159841 align=right>10,31</td>
<td class=xl159841 align=right>10,415</td>
<td class=xl159841 align=right>10,525</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>11</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>12</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl659841>Search:</td>
<td class=xl679841 align=right>7,30</td>
<td class=xl659841>Row</td>
<td class=xl669841 align=right>7</td>
<td class=xl159841 colspan=11><span style='mso-spacerun:yes'>
</span>=İNDİS($A:$A;MAK((MİN(MUTLAK(DataRange-$C$12))=MUTLAK(DataRange-$C$12))*SATIR(DataRange)))</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>13</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl659841>Column</td>
<td class=xl719841 align=right style='border-top:none'>5,00%</td>
<td class=xl159841 colspan=11><span style='mso-spacerun:yes'>
</span>=İNDİS($1:$1;1;MAK((MİN(MUTLAK(DataRange-$C$12))=MUTLAK(DataRange-$C$12))*SÜTUN(DataRange)))</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>14</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>15</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl749841 colspan=10>This formula is OK as row# "7" but is
it possible to display "E7" instead of "F6" as column
title?</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>16</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl749841 colspan=12>Can the formula check row# first to retrieve
the colum title then check for others if no figure is identical in row
"7" line?</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl759841 style='height:15.0pt'>18</td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
<td class=xl159841></td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=26 style='width:20pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
</tr>
<![endif]>
</table>
</div>
<!----------------------------->
<!--EXCEL WEB SAYFASI OLARAK YAYIMLA SİHİRBAZI ÇIKTI SONU-->
<!----------------------------->
</body>
</html>

I guess there must be a prettier answer to this, but this worked for me:
In E12 put this:
=ROUNDDOWN(C12,0)
And in E13 put this Array-Formula (need to be entered with Ctrl+Shift+Enter instead of the usual Enter):
=MATCH(MIN(ABS(C12-B3:F10)),ABS(C12-INDIRECT(CONCATENATE("B",E12)):INDIRECT(CONCATENATE("F",E12))),0)
Hope this helps

These formulas must be array-entered:
Row: =INDEX($A:$A,MAX((MIN(ABS(DataRange-$C$12))=ABS(DataRange-$C$12))*ROW(DataRange)))
Column: =INDEX($1:$1,1,MAX((MIN(ABS(DataRange-$C$12))=ABS(DataRange-$C$12))*COLUMN(DataRange)))
EDIT: If there is a possibility of duplicates in the table (two values that are equidistant from the search value, then the following formula will ensure that Column comes from the same row as the row value found.
Row: Formula in C12
Column: =INDEX($1:$1,1,MAX((MIN(ABS(INDEX(DataRange,E12-ROW(DataRange)+1,0)-$C$12))=ABS(INDEX(DataRange,E12-ROW(DataRange)+1,0)-$C$12))*COLUMN(DataRange)))
In your example,
DataRange refers to: =Sheet1!$B$3:$F$10
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
ctrl+shift while hitting enter. If you did this
correctly, Excel will place braces {...} around the formula.

In E12, the row:
=INDEX(A:A,AGGREGATE(15,6,($B$3:$F$10)/(AGGREGATE(15,6,ABS(C12-$B$3:$F$10),1)=ABS(C12-$B$3:$F$10)),1))
In E13, the column:
=INDEX(1:1,AGGREGATE(15,6,COLUMN($B$3:$F$10)/(AGGREGATE(15,6,ABS(C12-$B$3:$F$10),1)=ABS(C12-$B$3:$F$10)),1))

Related

Python multiple if statements for petrol price movement

Situation:
I buy a certain volume of petrol at price X, which is usually sold within a 30 days. During these 30 days, I will need to adjust my petrol station gas price according to average State gas price. If State price goes up by 1.2% from my purchased price, I will set my price to +1% of my purchased price.
Here is an example:
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-wa1i{font-weight:bold;text-align:center;vertical-align:middle}
.tg .tg-7zrl{text-align:left;vertical-align:bottom}
.tg .tg-0lax{text-align:left;vertical-align:top}
</style>
<table class="tg">
<thead>
<tr>
<th class="tg-wa1i">Time</th>
<th class="tg-wa1i">Average state gas price</th>
<th class="tg-wa1i">Av state price change, %</th>
<th class="tg-wa1i">My price change, %</th>
<th class="tg-wa1i">My station gas price</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-7zrl">1</td>
<td class="tg-0lax"> 4.231 </td>
<td class="tg-0lax"> - </td>
<td class="tg-0lax"> - </td>
<td class="tg-0lax"> 4.231 </td>
</tr>
<tr>
<td class="tg-7zrl">2</td>
<td class="tg-0lax"> 4.337 </td>
<td class="tg-0lax"> 2.5%</td>
<td class="tg-0lax"> 2.0%</td>
<td class="tg-0lax"> 4.316 </td>
</tr>
<tr>
<td class="tg-7zrl">3</td>
<td class="tg-0lax"> 4.437 </td>
<td class="tg-0lax"> 4.9%</td>
<td class="tg-0lax"> 4.0%</td>
<td class="tg-0lax"> 4.400 </td>
</tr>
<tr>
<td class="tg-7zrl">4</td>
<td class="tg-0lax"> 4.481 </td>
<td class="tg-0lax"> 5.9%</td>
<td class="tg-0lax"> 5.0%</td>
<td class="tg-0lax"> 4.443 </td>
</tr>
<tr>
<td class="tg-7zrl">5</td>
<td class="tg-0lax"> 4.571 </td>
<td class="tg-0lax"> 8.0%</td>
<td class="tg-0lax"> 8.0%</td>
<td class="tg-0lax"> 4.569 </td>
</tr>
<tr>
<td class="tg-7zrl">6</td>
<td class="tg-0lax"> 4.616 </td>
<td class="tg-0lax"> 9.1%</td>
<td class="tg-0lax"> 9.0%</td>
<td class="tg-0lax"> 4.612 </td>
</tr>
<tr>
<td class="tg-7zrl">7</td>
<td class="tg-0lax"> 4.709 </td>
<td class="tg-0lax"> 11.3%</td>
<td class="tg-0lax"> 11.0%</td>
<td class="tg-0lax"> 4.696 </td>
</tr>
<tr>
<td class="tg-7zrl">8</td>
<td class="tg-0lax"> 4.850 </td>
<td class="tg-0lax"> 14.6%</td>
<td class="tg-0lax"> 14.0%</td>
<td class="tg-0lax"> 4.823 </td>
</tr>
</tbody>
</table>
Here is a python code but it is very clunky, and if gas price moves up by 20%, then I have to write my_priceX up to 20 times. Is there a more elegant solution?
my_price1 = last_gas_price["price"]*1.01
my_price2 = last_gas_price["price"]*1.02
my_price3 = last_gas_price["price"]*1.03
my_price4 = last_gas_price["price"]*1.04
my_price5 = last_gas_price["price"]*1.05
if last_gas_price > my_price1:
adj_price(price = my_price1)
if last_gas_price > my_price2:
adj_price(price = my_price2)
if last_gas_price > my_price3:
adj_price(price = my_price3)
if last_gas_price > my_price4:
adj_price(price = my_price4)
if last_gas_price > my_price5:
adj_price(price = my_price5)

Check for vertical scrollbar in html local file

I have a VBA code that opens local HTML files using selenium like that
bot.Get "file:///" & Environ("USERPROFILE") & "\Desktop\OutputHTML.html"
Sometimes I got an error Out of memory as I am trying to take a screen shot for large size of the table (inside the HTML body)
Is it possible to check if there is a vertical scrollbar of the selenium browser and if there is a vertical scrollbar, I need to zoom in till this scrollbar disappears?
This is the code for you to test
Private bot As Selenium.ChromeDriver
Sub Test()
Dim eleTable As Selenium.WebElement, strPath As String, img As Image
Set bot = New Selenium.ChromeDriver
strPath = ThisWorkbook.Path & "\"
bot.Get "file:///" & Environ("USERPROFILE") & "\Desktop\OutputHTML.html"
Set eleTable = Nothing
On Error Resume Next
Set eleTable = bot.FindElementByCss(".table-striped")
On Error GoTo 0
If Not eleTable Is Nothing Then
Set img = eleTable.ScrollIntoView().TakeScreenshot()
img.SaveAs strPath & "Output.png"
Else
Debug.Print "Error In Taking Screenshot"
End If
End Sub
and this is example of the HTML local file
<bdo dir="rtl"><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
<style type="text/css">
th,td{
text-align: center !important;
}
</style>
<table class="table table-striped">
<tr class="">
<th width="5%" style="text-align:center;">م</th>
<th width="15%" style="text-align:center;">التاريخ</th>
<th style="text-align:center;">العملية</th>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>1</td>
<td dir="ltr">2022-02-23</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>2</td>
<td dir="ltr">2022-02-22</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>3</td>
<td dir="ltr">2022-02-22</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>4</td>
<td dir="ltr">2022-02-14</td>
<td style="padding-right:10px;">اذن صرف</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>5</td>
<td dir="ltr">2022-02-14</td>
<td style="padding-right:10px;">استمارة صــرف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>6</td>
<td dir="ltr">2022-01-19</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>7</td>
<td dir="ltr">2022-01-18</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>8</td>
<td dir="ltr">2022-01-18</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>9</td>
<td dir="ltr">2021-12-27</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>10</td>
<td dir="ltr">2021-12-26</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>11</td>
<td dir="ltr">2021-12-26</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>12</td>
<td dir="ltr">2021-11-22</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>13</td>
<td dir="ltr">2021-11-21</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>14</td>
<td dir="ltr">2021-11-21</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>15</td>
<td dir="ltr">2021-11-15</td>
<td style="padding-right:10px;">اذن صرف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>16</td>
<td dir="ltr">2021-11-15</td>
<td style="padding-right:10px;">استمارة صــرف</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>17</td>
<td dir="ltr">2021-10-19</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>18</td>
<td dir="ltr">2021-10-18</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>19</td>
<td dir="ltr">2021-10-18</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>20</td>
<td dir="ltr">2021-09-15</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>21</td>
<td dir="ltr">2021-09-14</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>22</td>
<td dir="ltr">2021-09-14</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>23</td>
<td dir="ltr">2021-09-12</td>
<td style="padding-right:10px;">اذن صرف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>24</td>
<td dir="ltr">2021-09-12</td>
<td style="padding-right:10px;">استمارة صــرف</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>25</td>
<td dir="ltr">2021-09-12</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>26</td>
<td dir="ltr">2021-08-23</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>27</td>
<td dir="ltr">2021-08-22</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>28</td>
<td dir="ltr">2021-08-22</td>
<td style="padding-right:10px;">ايصال توريد</td>
</tr>
<tr class="resultRowOdd" align="center" style="line-height:25px;">
<td>29</td>
<td dir="ltr">2021-08-02</td>
<td style="padding-right:10px;">اعادة فتح ملف )مغلق(</td>
</tr>
<tr class="resultRowEven" align="center" style="line-height:25px;">
<td>30</td>
<td dir="ltr">2021-08-01</td>
<td style="padding-right:10px;">اغلاق ملف</td>
</tr>
</table>
</html></bdo>
I tried such a line to check the vertical scrollbar
Debug.Print bot.ExecuteScript("return document.documentElement.scrollHeight>document.documentElement.clientHeight;")
But this returns False although there's a scroll bar
I tried this line bot.ExecuteScript "document.body.style.zoom='90%';" to make the zoom out but I got another error Element outside the screenshot

How to add a button inside of 1 cell inside a table on SharePoint?

I'm trying to add a button that links out to another website inside of a cell in SharePoint but it keeps moving the button to either above or below the table and not inside of the cell.
Is it possible to do this with either an embed code or an HTML code that I could place within "Edit Source" under "Content Editor"?
Any help on this would be appreciated. I have been researching solutions all day.
The below is currently what is being used. Am I doing something wrong?
<span style="font-size: 10px;">
<font face="Verdana">
<a href="/sites/Global_OE/SitePages/Forms/ByAuthor.aspx">
<strong>
<input name="HONDA" type="button" value="Case for Change & Sponsorship " style="background-color: #336699; color: #ffffff;"/>
</strong>
</a>
</font>
</span>
<table cellspacing="0" width="100%" class="ms-rteTable-default">
<tbody>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">​<br/>​<br/></td>
<td class="ms-rteTableOddCol-default" style="width: 20%; text-align: center;">
<style="background-color: style="font-family: optima;">​<img src="/sites/Global_OE/homepagedraft/SiteAssets/SitePages/Test/Picture1.png" alt="Picture1.png" style="margin: 5px; width: 25px; height: 25px;"/><span class="ms-rteFontSize-4">Diagn​​ose & Scope</span>​<br/></style="background-color:></td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableOddCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
</td>
<td class="ms-rteTableOddCol-default">
<p>
<span style="font-family: optima;">•Align to the business strategy</span></p>
<p>
<span style="font-family: optima;">•Align on what success looks like with leader and/ or sponsor</span></p>
</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">
<div>​OE </div>
<div> Getting Started & Tracking Progress<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​​​​​​​​​​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Change Management<sup>3
<br/></sup>(Complex Change)<br/></td>
<td class="ms-rteTableOddCol-default">​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Organization Design<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
<div style="text-align: center;">​Everyday Change </div>
<div style="text-align: center;">(Team Effectiveness)<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​​Process Enablement<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
</tbody>
</table>
The following code for your reference.
<table cellspacing="0" width="100%" class="ms-rteTable-default">
<tbody>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">​
<span style="font-size: 10px;">
<font face="Verdana">
<a href="/sites/Global_OE/SitePages/Forms/ByAuthor.aspx">
<strong>
<input name="HONDA" type="button" value="Case for Change & Sponsorship" onclick="window.location.href='/sites/Global_OE/SitePages/Forms/ByAuthor.aspx'" style="background-color: #336699; color: #ffffff;"/>
</strong>
</a>
</font>
</span>
</td>
<td class="ms-rteTableOddCol-default" style="width: 20%; text-align: center;">
<style="background-color: style="font-family: optima;">​<img src="/sites/Global_OE/homepagedraft/SiteAssets/SitePages/Test/Picture1.png" alt="Picture1.png" style="margin: 5px; width: 25px; height: 25px;"/><span class="ms-rteFontSize-4">Diagn​​ose & Scope</span>​<br/></style="background-color:></td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableOddCol-default" style="width: 20%;">
</td>
<td class="ms-rteTableEvenCol-default" style="width: 20%;">
</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
</td>
<td class="ms-rteTableOddCol-default">
<p>
<span style="font-family: optima;">•Align to the business strategy</span></p>
<p>
<span style="font-family: optima;">•Align on what success looks like with leader and/ or sponsor</span></p>
</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">
<div>​OE </div>
<div> Getting Started & Tracking Progress<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​​​​​​​​​​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Change Management<sup>3
<br/></sup>(Complex Change)<br/></td>
<td class="ms-rteTableOddCol-default">​<br/></td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​Organization Design<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableOddRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px;">
<div style="text-align: center;">​Everyday Change </div>
<div style="text-align: center;">(Team Effectiveness)<br/></div>
</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
<tr class="ms-rteTableEvenRow-default">
<td class="ms-rteTableEvenCol-default" style="width: 206px; text-align: center;">​​Process Enablement<br/></td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
<td class="ms-rteTableOddCol-default">​</td>
<td class="ms-rteTableEvenCol-default">​</td>
</tr>
</tbody>
</table>

Excel VBA: Compley copy & paste

as many of us, I'm new to VBA. Often I can research the answers to my questions, but I suppose this on is too specific.
I got the following arrangement of data:
<table border=0 cellpadding=0 cellspacing=0 width=491 style='border-collapse:
collapse;table-layout:fixed;width:368pt'>
<col width=107 style='mso-width-source:userset;mso-width-alt:3913;width:80pt'>
<col width=64 span=6 style='width:48pt'>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 width=107 style='height:15.0pt;width:80pt'>Production site</td>
<td class=xl1523206 width=64 style='width:48pt'>Year</td>
<td class=xl1523206 width=64 style='width:48pt'>Part 1</td>
<td class=xl1523206 width=64 style='width:48pt'> Part 2</td>
<td class=xl1523206 width=64 style='width:48pt'>Part 3</td>
<td class=xl1523206 width=64 style='width:48pt'>Part 4</td>
<td class=xl1523206 width=64 style='width:48pt'>Part n</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Site A</td>
<td class=xl1523206 align=right>2017</td>
<td class=xl1523206 align=right>7</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>5</td>
<td class=xl1523206 align=right>3</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Site A</td>
<td class=xl1523206 align=right>2018</td>
<td class=xl1523206 align=right>8</td>
<td class=xl1523206 align=right>6</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>5</td>
<td class=xl1523206 align=right>3</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Site A</td>
<td class=xl1523206 align=right>2019</td>
<td class=xl1523206 align=right>8</td>
<td class=xl1523206 align=right>6</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>5</td>
<td class=xl1523206 align=right>3</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Site B</td>
<td class=xl1523206 align=right>2017</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>3</td>
<td class=xl1523206 align=right>1</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>0</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Site B</td>
<td class=xl1523206 align=right>2018</td>
<td class=xl1523206 align=right>7</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>1</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>0</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Site B</td>
<td class=xl1523206 align=right>2019</td>
<td class=xl1523206 align=right>7</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>1</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>0</td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=107 style='width:80pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
</tr>
<![endif]>
</table>
The number of parts, production sites and years is not limited.
Now I need to copy the data and put it into a different structure to be able to work with it.
This is how the data must look like:
<table border=0 cellpadding=0 cellspacing=0 width=491 style='border-collapse:
collapse;table-layout:fixed;width:368pt'>
<col width=107 style='mso-width-source:userset;mso-width-alt:3913;width:80pt'>
<col width=64 span=6 style='width:48pt'>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 width=107 style='height:15.0pt;width:80pt'>Part</td>
<td class=xl1523206 width=64 style='width:48pt'>Production Site</td>
<td class=xl1523206 width=64 style='width:48pt'>2017</td>
<td class=xl1523206 width=64 style='width:48pt'>2018</td>
<td class=xl1523206 width=64 style='width:48pt'>2019</td>
<td class=xl1523206 width=64 style='width:48pt'></td>
<td class=xl1523206 width=64 style='width:48pt'>Year n</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Part 1</td>
<td class=xl1523206 align=right>Site A</td>
<td class=xl1523206 align=right>7</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>5</td>
<td class=xl1523206 align=right>3</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Part 1</td>
<td class=xl1523206 align=right>Site B</td>
<td class=xl1523206 align=right>8</td>
<td class=xl1523206 align=right>6</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>5</td>
<td class=xl1523206 align=right>3</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Part 1</td>
<td class=xl1523206 align=right>Site n</td>
<td class=xl1523206 align=right>8</td>
<td class=xl1523206 align=right>6</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>5</td>
<td class=xl1523206 align=right>3</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Part 2</td>
<td class=xl1523206 align=right>Site A</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>3</td>
<td class=xl1523206 align=right>1</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>0</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Part 2</td>
<td class=xl1523206 align=right>Site B</td>
<td class=xl1523206 align=right>7</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>1</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>0</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl1523206 style='height:15.0pt'>Part 2</td>
<td class=xl1523206 align=right>Site n</td>
<td class=xl1523206 align=right>7</td>
<td class=xl1523206 align=right>4</td>
<td class=xl1523206 align=right>1</td>
<td class=xl1523206 align=right>2</td>
<td class=xl1523206 align=right>0</td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=107 style='width:80pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
<td width=64 style='width:48pt'></td>
</tr>
<![endif]>
</table>
I suppose I need to do all kind of indexing, looping and so on. Anybody with ideas to get my head around this task? I appreciate any input. Thanks a lot!
This can be done using Powerquery. You are unpivoting Part and pivoting on year.
Load the table using data > from table to import the source, in Excel 2013 use the powerquery add-in tab (free download from microsoft), in the editor window tha opens you then right clicking on columns to pivot/unpivot (or via transform tab) and finally close and load to sheet.

Tinymce copy/paste from excel (Plugin BBcode)

I'm using tinyMCE, below you can see the implementation.
Now the problem: when I copy some records from EXCEL and paste them in my tinymce field. It's displayed good enough for me (with plugin: paste, he will actually show the fields)
When i ask the value from my field I get a return with a table struct depeding what you paste. But I don't want any html, see below what I want.
Implementation code:
tinyMCE.init({
mode : "exact",
elements: "id",
theme : "advanced",
plugins : "bbcode, inlinepopups",
content_css : "tinymce.css",
entity_encoding : "raw",
remove_linebreaks : false,
forced_root_block: false,
force_br_newlines: true,
invalid_elements : "p, div, span",
force_p_newlines: false, t
heme_advanced_buttons1 : $cur_buttons,
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
init_instance_callback : "tiny_mce_callback"});
Return from tinyMCE object:
<table style="border-collapse: collapse;" width="216" border="0"
cellspacing="0" cellpadding="0">
<!--StartFragment-->
<colgroup>
<col style="mso-width-source: userset; mso-width-alt: 1152;" width="27"/>
<col width="55" />
<col style="mso-width-source: userset; mso-width-alt: 2858;"
span="2" width="67"/>
</colgroup>
<tbody>
<tr style="mso-height-source: userset;">
<td class="xl24" width="27" height="12">1</td>
<td class="xl26" width="55">26/05/12</td>
<td class="xl24" width="67">Amsterdam</td>
<td class="xl24" width="67">Casablanca</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">2</td>
<td class="xl25">27/05/12</td>
<td class="xl24">Casablanca</td>
<td class="xl24">Rabat</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">3</td>
<td class="xl25">28/05/12</td>
<td class="xl24">Rabat</td>
<td class="xl24">Fes</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">4</td>
<td class="xl25">29/05/12</td>
<td class="xl24">Fes</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">5</td>
<td class="xl25">30/05/12</td>
<td class="xl24">Fes</td>
<td class="xl24">Erg Chebbi</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">6</td>
<td class="xl25">31/05/12</td>
<td class="xl24">Erg Chebbi</td>
<td class="xl24">Dades Vallei</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">7</td>
<td class="xl25">01/06/12</td>
<td class="xl24">Dades Vallei</td>
<td class="xl24">Ouarzazate</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">8</td>
<td class="xl25">02/06/12</td>
<td class="xl24">Ouarzazate</td>
<td class="xl24">Marrakesh</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">9</td>
<td class="xl25">03/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">10</td>
<td class="xl25">04/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">11</td>
<td class="xl25">05/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24">Amsterdam</td>
</tr>
<!--EndFragment--></tbody>
</table>
Expected return:
1 26/05/12 Amsterdam Casablanca
2 27/05/12 Casablanca Rabat
3 28/05/12 Rabat Fes
4 29/05/12 Fes
5 30/05/12 Fes Erg Chebbi
6 31/05/12 Erg Chebbi Dades Vallei
7 01/06/12 Dades Vallei Ouarzazate
8 02/06/12 Ouarzazate Marrakesh
9 03/06/12 Marrakesh
10 04/06/12 Marrakesh
11 05/06/12 Marrakesh Amsterdam
You should have a look at the tinymce configuration options concerning the paste plugin.
Another option is to strip out all unwanted html tags and just use plain text: TinyMCE Paste As Plain Text

Resources