Pacing formula by hour rather than day - google-sheets

I have the below formula which calculates the current pacing of a campaign based on the number of clicks currently achieved vs the number of clicks it is meant to achieve. For example, if the campaign is supposed to achieve 100 clicks over 10 days, but then only gets 5 clicks in the first day, it'll be pacing at 50%.
It works well, however the pacing is only calculated by day, whereas I'd like to do it by hour. How can I achieve this? I tried dividing by 24 but that went horribly wrong!
Working (daily) formula below:
=SUM((S48/(Live!$B$1-G48 +1))*((H48-G48 +1)/K48))
S48 = number of clicks currently achieved
B1 = todays date (e.g. 21/07/2020)
G48 = start date of campaign used for pacing formula
H48 = end date of campaign used for pacing formula
K48 = total number of clicks the campaign needs to achieve

In the original formula, you don't need SUM(.
=(S48/(Live!$B$1-G48 +1))*((H48-G48 +1)/K48)
should work fine.
To make it work hourly, you'll need to make sure that B1 has the latest time and not just the latest date. You can automate that by using =now() instead of today().
The hourly formula is:
=(S48/((Live!$B$1-G48 +1)*24)*(((H48-G48 +1)*24)/K48))

Related

Tableau: how to create calculated field for previous day value

I have created a monthly calendar in tableau that tracks enrollment sign ups for a business's rewards program. What I am trying to do is show the day over day % change between enrollment values. In this specific scenario, I am trying to find the % change between 371 to 499. However, to do this, I believe I first need to create a calculated field for the prior days value, so that I can then use the day over day % formula for all other values. Does anyone have any advice for this particular scenario?
I have tried using the datediff function, amongst other calculated fields, with no luck so far. I want to created a calculated field that will retrieve all "enrollment" values but only for the previous day, so that I can then use the "100*((final-initial)/initial) calculation to calculate the day to day % difference.
You can try this function. I think this might be the calc you need.
(ZN(SUM([Distance])) - LOOKUP(ZN(SUM([Distance])), -1)) /
ABS(LOOKUP(ZN(SUM([Distance])), -1))
You might have to play with the sign to get the result you want. Let me know if that doesn't work.

Conditional Formatting Time After Midnight in Google Sheets

I'm working on a Google Sheets timesheet. I want to conditionally format a cell if the user enters a Time Out past Midnight. In the example below, the user added an extra 15 minutes to his Time Out, which belongs on the row for the next day.
timesheet
I tried Conditionally Formatting a cell for any time greater than Midnight, which didn't work because ALL times are beyond Midnight. Also, I want to apply the conditional formatting to every cell in my Time Out columns. So I'm guessing the solution must involve the ARRAY function.
Any suggestions? Thanks in advance!
Assuming you mean that you need to highlight those timelines that start in one day and finish in the next one, you can think that the condition will be true if the hour of leaving is smaller than the hour of arriving (unless you can have more than 24 hours straight, in which case this wouldn't work).
Then you could set this condition:
=if(hour($C2)<hour($B2),true,false)

Find Number of Days in Current Month That Fall Between Date Range In Google Sheets

I'm trying to come up with a function that will calculate a monthly budget from within a specified date range. I tried to use SUMIFS but I can't figure out how to isolate a specific month within the range.
Example:
We have a sheet with Google Ad campaigns, with a row for each campaign.
We are running one Google Ad campaign (A) from 2/15/20 to 5/15/20 with a total budget of $3000 from which I calculate a daily budget of $33.33.
We are running a second campaign (B) from 5/15/20 to 8/15/20, also with a budget of $3,000, from which I calculate a daily budget of $32.61.
=IF(NOT(ISBLANK(Start_Date)),Total_Budget/(End_Date-Start_Date),"")
In a separate sheet, I have Budget and Spend fields for each month. For May, I need it to calculate the total budget for 5/1-5/15 of Campaign A, and 5/15-5/31 of Campaign B.
I got this far (J is the Daily_Budget, G is the Start_Date, and H is the End_Date):
=SUMIFS(Google!J2:J30, Google!G2:G30,"<="&DATE(2020,5,1),Google!H2:H30,">="&DATE(2020,5,31))
Then I was at a loss for how to extrapolate the number of days from the range, so that I could then multiply them by the Daily Budget and then add them together.
I thought of going back to the sheet that contains the campaigns and adding columns for each month with a complicated conditional, and then just using SUM(), but I feel like there has to be a more elegant solution.
UPDATE
Per request, here is a link to the spreadsheet with the desired results manually entered: Click here. May & June show the campaign partial month overlaps. The result I'm ultimately going for is =(15*Google!J2)+(16*Google!J3).
UPDATE 2 (24Jun20)
Per request, I have shared the spreadsheet so that people can make a copy and experiment with formulas: Click here..
Any ideas?
Thanks,
Ty
I would use the function DATEDIF() (documentation here). You can set the first parameter as the first day of the month you are trying to calculate the number of days within it, and the second as the first day from another month. Example:
DATEDIF(DATE(2020, 1, 1), DATE(2020, 2, 1), "D")
You could probably make a custom function with this as well to input only the number of each month (and year, in case of leap years on February), but I don't have much experience with that unfortunately.

Average of cell content based on day of month

I'm attempting to get an average number of calls/day based on yesterday's date.
My initial formula looks like this: =round(average(C24/3),2), where:
C24 = the total number of calls,
/3 = diving the contents of C24 by yesterday (assuming yesterday was the 3rd of the month),
,2 = rounding answer to 2 decimal places.
The formula itself works fine, but I have to go in daily to change the 'date' (/3, in my example).
Any suggestions as to how I can automate this formula so as to not have to go in to change the day of the month every day?
(for what it's worth, i tried using =round(average(C24/today()),2), but get a divide by zero error. Not sure what else to try. I also googled rolling averages/moving averages, but that didn't seem to help either.)
Use DAY and TODAY.
=DAY(TODAY()-1)
So
=ROUND(AVERAGE(C24/DAY(TODAY()-1)),2)

Add numbers in Column B based and on Day of the Week in Column A and display highest/lowest resulting Day

I have a sheet that lists every day of the year and is updated on a daily basis. Next to each day is a percentage. I would like to display the day of the week that has the highest (and lowest) percentage when adding all relative days throughout the year. (i.e.: all Thursdays)
I am using this formula, which only partially works. It displays the day of the week, but seems to only reference the latest occurrence instead of all in Column A.
B2:
=iferror(INDEX($A4:$A,MATCH(MAX(B4:B),B4:B,0)),"")
B3:
=iferror(INDEX($A4:$A,MATCH(MIN(B4:B),B4:B,0)),"")
Link to a sample book: https://docs.google.com/spreadsheets/d/1_LP5MmmgW3i0zM6ziud9YrWfH5SvuHFbZH3OmRj9W6E/edit#gid=0
I hope this is enough information to understand what I am hoping to accomplish.. Is this possible in Google Sheets?
If I can get this to work my second goal would be to show the highest/lowest for the current month (or a specific month) in addition to the whole year.
Thanks!
Take a look at the shared spreadsheet and see if it does what you want.
https://docs.google.com/spreadsheets/d/1LL4Mgn_IWa-8W6Q0TythdMhBieVFt8ZiKI_UeO9ciTI/edit?usp=sharing
Added col L,O,R,and U for numeric day of week, current month,
current year, and month number. You can hide these columns.
I added some data for testing.

Resources