Supposed i have the following table:
<table>
<tr>
<th>product</th>
<th>date</th>
<th>price</th>
</tr>
<tr>
<td>xyz</td>
<td>6/1/2017</td>
<td>11.0</td>
</tr>
<tr>
<td>xyz</td>
<td>6/2/2017</td>
<td>11.2</td>
</tr>
<tr>
<td>xyz</td>
<td>6/3/2017</td>
<td>11.1</td>
</tr>
<tr>
<td>xyz</td>
<td>6/4/2017</td>
<td>11.3</td>
</tr>
<tr>
<td>xyz</td>
<td>6/5/2017</td>
<td>11.3</td>
</tr>
<tr>
<td>abc</td>
<td>6/1/2017</td>
<td>7.5</td>
</tr>
<tr>
<td>abc</td>
<td>6/2/2017</td>
<td>7.5</td>
</tr>
<tr>
<td>abc</td>
<td>6/3/2017</td>
<td>7.5</td>
</tr>
<tr>
<td>abc</td>
<td>6/4/2017</td>
<td>7.6</td>
</tr>
</table>
And i want to generate a table that looks like below. The Product column can be inserted manually. But I want the "Total count of price increase" to be generated using Excel formula.
<table>
<tr>
<td>Product</td>
<td>Total count of price increase</td>
</tr>
<tr>
<td>xyz</td>
<td>2</td>
</tr>
<tr>
<td>abc</td>
<td>1</td>
</tr>
</table>
Is it possible to do so? I tried CountIfs with OFFSet but i could not figure out how to compare with the previous day's price.
This formula works if your first table's data is already sorted by product. Enter this into Sheet2!B2 and fill down:
B2:
=SUMPRODUCT((Sheet1!$A$2:$A$100 = A2) * (Sheet1!$A$3:$A$101 = A2)*
(Sheet1!$C$3:$C$101 > Sheet1!$C$2:$C$100))
Related
Using Python 3.8 I need to get the date/year and the average from a website and save it under an Excel sheet.
The structure is as follows
01/01/2014 – 01/01/2015 2.1
01/01/2016 – 01/01/2017 1.0
01/01/2018 – 01/01/2019 4.0
I want to save all the dates/month/year under each cell including the average
Example
Cell 1 Cell 2
Row1 01/01/2014 – 01/01/2015 2.1
Row1 01/01/2016 – 01/01/2017 1.0
So I pull the web elements as follows
Dates_avg = driver.find_elements_by_xpath("//table[#class='performance']")
This would contain all the information (dates/month/year and the average).
I am trying to find a way to segregate them.
I tried datetime, trying to convert as above, so I can apply something like below
Dates_avg = str(driver.find_elements_by_xpath("//table[#class='performance']"))
data1_1 = dt.datetime.strptime(Dates_avg '"%d-%m-%Y"').date()
Without success. Any help would be greatly apricated
thanks in advance
Apologies for the delay in response. Kindly see the HTML tag for this.
Also, I understand once I import this "Dates_avg" it's a list. I am trying to figure out how to get this list and convert to date/month/year and put them on an Excel, so I can run some reports/stats
Also note, this page is dynamically loaded, s there is no static link
<tbody>
<tr>
<th scope="row">
<span class="performance">30/08/15</span> - <span class="performanceEnd">30/08/16</span>
</th>
<td class="value">11.22</td>
</tr>
<tr>
<th scope="row">
<span class="performance">30/08/16</span> - <span class="performanceEnd">30/08/17</span>
</th>
<td class="value">10.12</td>
</tr>
<tr>
<th scope="row">
<span class="performance">30/08/17</span> - <span class="performanceEnd">30/08/18</span>
</th>
<td class="value"> 5.16</td></tr>
<tr>
<th scope="row">
<span class="performance">30/08/18</span> - <span class="performanceEnd">30/08/19</span>
</th>
<td class="value">-0.64</td>
</tr>
<tr>
<th scope="row">
<span class="performance">30/08/19</span> - <span class="performanceEnd">30/08/20</span>
</th>
<td class="value">-1.55</td>
</tr>
Excel formula : Interpolate in a second column between dynamic repeating integer values in the first column.
In one column of an Excel sheet I have an ascending series of integer values, which increment after several rows. In the next column I wish to use a formula based solution to generate evenly distributed values, creating between one integer and the next. The increment will depend on how many rows it takes for the integer in the first column to increase by 1.
I'm pretty good with Excel, but this one has really stumped me - nothing I have produced does it so far.
If the first column is static, that is easy enough, but as it isn't I'm struggling.
Could anyone point me in the right direction of a suitable formula.
Here's what I should get:
<html>
<table width:156pt>
<col width:82pt>
<col width:74pt>
<tr>
<td>Column
A</td>
<td>Column B</td>
</tr>
<tr >
<td>(These values are from a lookup table, and can change, so
the formulas in Column B need to account for this).</td>
<td>(This is where the formula is needed).</td>
</tr>
<tr>
<td >1</td>
<td >1</td>
</tr>
<tr>
<td >1</td>
<td >1.2</td>
</tr>
<tr>
<td >1</td>
<td >1.4</td>
</tr>
<tr>
<td >1</td>
<td >1.6</td>
</tr>
<tr>
<td >1</td>
<td >1.8</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>2.33</td>
</tr>
<tr>
<td>2</td>
<td>3.67</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>3</td>
<td>3.25</td>
</tr>
<tr>
<td>3</td>
<td>3.5</td>
</tr>
<tr>
<td>3</td>
<td>3.75</td>
</tr>
<tr>
<td>4</td>
<td>4</td>
</tr>
</table>
</html>
Thanks
In B1 put:
=A1+(1/COUNTIF(A:A,A1))*(COUNTIF($A$1:A1,A1)-1)
I'm newer to writing scripts for Excel and trying to figure out how to write a formula which does the following.
Given a dataset such as below, figure out if any hamburgers with the exact same project name have been shipped. There can be multiple rows for a given hamburger in a single project. However, if no rows indicate that a hamburger within a single project has been shipped, then the final result should be the number 0. If at least one row for a single hamburger project contains the status "shipped", then the final result should be the number 1.
Consider the following table. The script I'm trying to write would find Project B and indicate all lines next to it with a result number 0. However, Projects C & D would have "1" next to them for all their respective rows.
<table>
<tr>
<th>Project</th>
<th>Product</th>
<th>Status</th>
</tr>
<tr>
<td>A</td>
<td>Fry</td>
<td>New</td>
</tr>
<tr>
<td>A</td>
<td>Fry</td>
<td>Prep</td>
</tr>
<tr>
<td>A</td>
<td>Fry</td>
<td>Shipped</td>
</tr>
<tr>
<td>B</td>
<td>Hamburger</td>
<td>New</td>
</tr>
<tr>
<td>B</td>
<td>Hamburger</td>
<td>Prep</td>
</tr>
<tr>
<td>C</td>
<td>Hamburger</td>
<td>New</td>
</tr>
<tr>
<td>C</td>
<td>Hamburger</td>
<td>Prep</td>
</tr>
<tr>
<td>C</td>
<td>Hamburger</td>
<td>Shipped</td>
</tr>
<tr>
<td>D</td>
<td>Hamburger</td>
<td>New</td>
</tr>
<tr>
<td>D</td>
<td>Hamburger</td>
<td>Prep</td>
</tr>
<tr>
<td>D</td>
<td>Hamburger</td>
<td>Shipped</td>
</tr>
</table>
I tried to write an If statement but I'm absolutely clueless on how to even start. It went
=if(AND(MATCH(B2,B:B,0), AND(MATCH("Shipped",C:C,0)), 1, 0)
which I realize is probably strange as it is.
A simple countifs should getr the result; wrap a sign function around it to get one or zero.
=SIGN(COUNTIFS(A:A, F2, B:B, G2, C:C, H$1))
Need to extract some data from Html that looks like:
<div class="r_tbar0 positionrelative">
<h3>Financials</h3>
</div>
<table class="r_table1 text2" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th scope="row" align="left"></th>
<th scope="col" id="Y0" align="right">2007-12</th>
<th scope="col" id="Y1" align="right">2008-12</th>
<!--More columns here-->
<th scope="col" id="Y9" align="right">2016-12</th>
<th scope="col" id="Y10" align="right">TTM</th>
</tr>
</thead>
<tbody>
<tr class="hr">
<td colspan="12"></td>
</tr>
<tr>
<th class="row_lbl" scope="row" id="i0">Revenue <span>USD Mil</span></th>
<td headers="Y0 i0" align="right">5,858</td>
<td headers="Y1 i0" align="right">5,808</td>
<!--More cells here-->
<td headers="Y9 i0" align="right">4,272</td>
<td headers="Y10 i0" align="right">4,955</td>
</tr>
<tr class="hr">
<td colspan="12"></td>
</tr>
<tr>
<th class="row_lbl" scope="row" id="i1">Gross Margin %</th>
<td headers="Y0 i1" align="right">37.4</td>
<td headers="Y1 i1" align="right">39.9</td>
<!--More cells here-->
<td headers="Y9 i1" align="right">23.4</td>
<td headers="Y10 i1" align="right">33.5</td>
</tr>
<!--More rows here-->
<tr class="hr">
<td colspan="12"></td>
</tr>
</tbody>
</table>
I am looking to pull say the 2007 revenue data XPATH from the key ratios page by searching for the "Revenue" row then looking at the 2007 column.
XPATH Location of the 2007 revenue:
//*[#id="financials"]/table/tbody/tr[2]/td[1]
The tr[2] represents the row that Revenue is aligned to. However, if I have a program that looks at multiple stocks I want to make sure that tr[2] still looks at revenue.
I have tried multiple versions of the following XPATH which returns a NULL value. (I am using XPATH helper a google chrome extension)
//*[#id="financials"]/table/tbody/tr[contains(text(),'Revenue')]/td[1]
Outer html code for the Revenue row:
<th class="row_lbl" scope="row" id="i0">Revenue <span>USD Mil</span></th>
Outer html code for 2007 Revenue:
<td align="right" headers="Y0 i0" class="">5,858</td>
Update
Based on below answer I've written:
//*[#id='financials']//td[contains(#headers,'i0')][1]
Pulls the 2017 Revenue data 5,858
In "Financials" table, "Revenue" is a th, not a tr. You can get all cells in a column or row of that table by referencing the header attribute of td tags. Columns are Y0..Yn and rows are i0..in, for example:
First column has header Y0:
//*[#id='financials']//td[contains(#headers,'Y0')]
First row has header i0:
//*[#id='financials']//td[contains(#headers,'i0')]
And so on
I'm making a timetable for our colleague, I have a table as following,
Value A = 4 / Value B = 4 Value F = 8
and I need to know the amount between Mon to Fri amount, not sure what is the exact function that I should use.
I tried this:
=SUM(IF(B6:AE6="F",VALUE("8"),VALUE("4")))
But is not working
<table border="1">
<tr>
<td>
Mon
</td>
<td>
Tue
</td>
<td>
Wed
</td>
<td>
Thu
</td>
<td>
Fri
</td>
</tr>
<tr>
<td>
A
</td>
<td>
A
</td>
<td>
F
</td>
<td>
B
</td>
<td>
B
</td>
</tr>
</table>
The following array-formula should help you. Array-formula means that you enter it with
Ctrl+Shift+Enter
You do not enter the { } brackets manually, they will appear automatically.
{=SUM(--($A$2:$E$2="A")*4,--($A$2:$E$2="B")*4,--($A$2:$E$2="F")*8)}
The values for Monday to Friday are in A2:E2 in this example.
I solved the problem with this code:
=4*COUNTIF(B6:AE6,"A")+4*COUNTIF(B6:AE6,"B")+8*COUNTIF(B6:AE6,"F")