How to append today's price in historical GoogleFinance prices to generate SPARKLINE? - array-merge

I am trying to make SPARKLINE in Google Sheet with this formula:
=SPARKLINE(INDEX(GOOGLEFINANCE("AAPL", "close", WORKDAY(TODAY(), -100), TODAY()), , 2))
It shows a perfect line chart, but it fetches data till yesterday's date. I want today's live price append to this data. I can get today price with this formula:
=GOOGLEFINANCE("AAPL","price")
For Example,
But I don't know how to add today's price at the end of the old historical price so I can generate live SPARKLINE.
Please suggest a solution or you have any different approach to solve this problem.
Thanks

Try this
=SPARKLINE({INDEX(GOOGLEFINANCE("AAPL", "close", WORKDAY(TODAY(), -100), TODAY()));today(),GOOGLEFINANCE("AAPL","price")})

Related

How can I apply 2 date controls on report/page level?

I want to know if it is possible to have 2 date range controls on my page. Each date range control would be connected to a different date (Purchase date / Consumption date) of our products).
Here is a simplified editable copy of the data studio report.
The Google Sheet source looks like:
ID
Purchase date
Consumption date
Product
Price
ABCD12
21/03/2022
09/11/2022
A
£50
EFGH34
22/03/2022
22/11/2022
B
£80
IJKL56
23/04/2022
15/11/2022
A
£50
MNOP78
24/03/2022
06/12/2022
A
£50
The output I'm looking for is to be able to filter data so that I can answer the question "how many products were purchased in March 2022 that have a consumption date in November 2022". The expected output is as follows:
ID
Purchase date
Consumption date
Product
Price
ABCD12
21/03/2022
09/11/2022
A
£50
EFGH34
22/03/2022
22/11/2022
B
£80
Supermetrics has a Date Picker that essentially does what I need it to do. But it has 2 downsides 1) it is bulky and does not work well with many years of data and 2) It does not allow breaking down to more than a monthly level.
Is there another way to make this happen with parameters?
Through this post I've gotten as far as getting a 'switch' for my graphs and tables between the two date datapoints, but that is not the solution I'm looking for.
actually you did find already a good solution by the 3rd party Add-one "Date Picker" from Supermetrics. An alternative route is to include two tables which only have the consumption date as a column. The user can then select these and do a cross filtering of the main table.
In the first table, the dimension has to be changed to "Year Month":
An alternative community visualisation to the Date Picker (based on the limitations cited in the question) would be the Range Slider.
Two Range Sliders could be used (one for each date field), however, the below will use one Date range control and one Range Slider to demonstrate that they can work together (as well as maintaining the original setup in the question):
1) Purchase date
1.1) Date range control
1.2) Table
Date Range Dimension: Purchase date
Dimension 1: ID
Dimension 2: Purchase date
Dimension 3: Consumption date
Dimension 4: Product
Metric: Price
2) Consumption date
2.1) Range Slider
Column to filter on: Consumption date
(Chart Interactions) Cross Filtering: ☑
Publicly editable Google Data Studio report (embedded Google Sheets data source) and a GIF to elaborate:

How to solve Google sheets formula issue

Hoping someone here can help with a small issue.
I'm writing an array formula, which uses a vlookup to pull prices. Identical items can be either on the sales floor, or in various overstock locations, and since they gradually increase in value, only the price attached to the version thats on the sales floor should be valid. Vlookup unfortunately pulls the price for the first match it finds.
I've cannibalized the following code from various sources online, and it does work at pulling the correct prices, however, it appends "Sales floor" to every price.
Is there something I'm missing, or a way to further refine it?
={"Variant Price";if(Checkbox!B1=TRUE,Arrayformula(IFERROR(VLOOKUP(A2:A&"Sales Floor",Inventory!A2:K&Inventory!N2:N,Column(J2:J),false))),"")}
The variant price and checkbox portions are simply to add a title, and to be able to control whether the formula is activated, this sheet has a large number of formulas that don't need to run constantly.
try:
={"Variant Price"; IF(Checkbox!B1=TRUE,
ARRAYFORMULA(SUBSTITUTE(IFERROR(VLOOKUP(A2:A&"Sales Floor",
Inventory!A2:K&Inventory!N2:N,Column(J2:J), 0)), "Sales Floor", )))}

Is there a way of using a row level formula to filter down to opportunities to the end of the month?

I am trying to use a row level formula to filter down a series of opportunities to ones which occur at the end of the month, or within 2/3 days of the end of the month.
I have the following columns: "Opp name", offer submission date, "closed date"
Purpose of the exercise: I would like to identify opportunities which have an offer submission date at the end of the month. Currently, I have filtered the report to last month.
What I would like to do: I would like to filter the data down using a row level formula, so that I have all the opportunities which have an offer submission date around the end of the last month NOT just in the last month.
Please could someone advise me as to the syntax for such a row level formula. Huge thanks in advance!
**** Edit****
This is now what my formula looks like.
And the results are:
As you can see, the records which should be highlighted as 1 (and therefore 'True') aren't. Any help would be hugely appreciated.
My formula runs on Case Last Modified Date, you'll have to change field name. And mine's "DateTime" really, if your custom field is Date only - you don't need DATEVALUE().
For illustration let's say anything after 20th is month's end
IF(DAY(DATEVALUE(LAST_UPDATE)) > 20, 1, 0)
Looks promising:
You can decide to make it a Text formula or maybe really just display the day of the month and filter / sort by it... Doesn't matter much, all yours?

Excel IF Function Query - Dates

I am looking for some help regarding an IF function on an Excel document.
Basically if the Date Listed cell is dated over 1 month ago (eg: Date Listed 6-Aug but today is 6-Sep) and the Date Sold cell is blank, then I would like the Mark Down cell to say 'MARK DOWN', which at the moment it does but it is only 10-Aug today.
If the Date Listed cell and the Date Sold cell both contain dates I would like the Mark Down cell to say 'OK'.
So far I have this written:
=IF(AND(DATE(YEAR(G2),MONTH(G2),DAY(G2)), ISBLANK(H2)),"MARK DOWN","OK")
I know I'm not far off but I need help sorting out the last parts..
Bonus if you can help me add a highlighted cell formatting to it :)!
[EXAMPLE IMAGE]
I think this should work
IF(AND((TODAY()-g2)>31,ISBLANK(H2)),"Mark Down","OK")
Apply conditional formatting on all the cells in MARK DOWN column which are equal to OK.
After that write this simple formula to check the condition.
=IF(AND(ISNUMBER(G2),ISNUMBER(H2)),"OK","MARK DOWN")
Update: if you use EDATE function everything gets simplified as this function takes care of exact day differences
so the whole solution is :
=IF(AND(EDATE((G2),1)=EDATE(NOW(),0),ISBLANK(H2)),"MarkDown","")
Let me know if you have any question on how this formula works.

Short Formula To Pull Upcoming Holidays For a Title Merge In A Huge Database

I am Using excel 2007 and running Windows 7 Pro. I have 50 Thousand rows with data.
I am trying to do a formula that gives me a value of the next upcoming holiday. I have 4 columns of holidays.
For example: Today's date is 6/3/2015 next upcoming holiday would be Father's Day and after that would be Halloween.
So, from Today's date to Father's Day the value would contain "Father's Day"
After Father's day, I want the formula to automatically replace "Father's day" with "Halloween" And doing the same to upcoming holidays after that.
I have researched forums and gotten ideas to compose a formula. I was able to create one, but the only way I got it to work was with the holiday's date instead of there name. If there is no other way of doing it besides that way I would be okay with it.
Only thing i'm concerned about is Opening, Saving, and Editing a file that large with a formula that big is very time consuming and unresponsive sometimes. I need help and would like to have a formula that dose what I need more efficiently and quicker.Any Ideas on shortening the formula?
Here is my formula:
=IF(SMALL(IF($A$2:$D$2>TODAY(),$A$2:$D$2),1)=DATE(YEAR(TODAY()),2,14),"Valentine's Day",IF(SMALL(IF($A$2:$D$2>TODAY(),$A$2:$D$2),1)=DATE(YEAR(TODAY()),4,5),"Easter Day",IF(SMALL(IF($A$2:$D$2>TODAY(),$A$2:$D$2),1)=DATE(YEAR(TODAY()),5,10),"Mother's Day",IF(SMALL(IF($A$2:$D$2>TODAY(),$A$2:$D$2),1)=DATE(YEAR(TODAY()),6,21),"Father's Day",IF(SMALL(IF($A$2:$D$2>TODAY(),$A$2:$D$2),1)=DATE(YEAR(TODAY()),10,31),"Halloween",IF(SMALL(IF($A$2:$D$2>TODAY(),$A$2:$D$2),1)=DATE(YEAR(TODAY()),12,25),"Christmas"))))))
I have dates in Array A2:D2
I have two differnt ways i can lay out my data. One way is with the holiday's name, and the other is with the holidays date. Examples are shown below... My formula displayed above is created to work with the first example below.
A B C D
2/14/2015 6/21/2015 10/31/2015 12/25/2015
OR
A B C D
Mother's day Father's day Halloween Christmas
I need it to read A-D search for the next upcoming holiday and return the value.
Thanks in advance for any help, tips, and ideas.
If the dates and names for the corresponding holidays are set up as such:
A B
2/14/2015 Valentine's Day
4/5/2015 Easter Day
5/10/2015 Mother's day
6/21/2015 Father's day
10/31/2015 Halloween
12/25/2015 Christmas
This formula can work to get the next holiday from today's date.
=INDEX(B2:B7,MATCH(TODAY(),A2:A7,1)+1)
If the names for the corresponding holidays are not within the list. You can hardcode them in the INDEX formula. Replace the first parameter with an array of hardcoded days, i.e:
{"Valentine's Day","Easter Day","Mother's Day","Father's day","Halloween","Christams"}
Even if we have the dates in a horizontal range, lets say A1:D1 we can still hardcode the days in an INDEX as such:
=INDEX({"Mother's Day","Father's day","Halloween","Christams"},MATCH(TODAY(),$A$1:$D$1,1)+1)

Resources