Is there a way to make excel expand dates in a spreadsheet - excel

I have a large two column data set that already has dates and data, whoever I need the dates to "expand" for daily data
I already attempted to auto-fill however it doesn't do what I need it to
I have a spreadsheet like this
date Data
07/01/19 5
07/03/19 10
09/05/19 7
I'd like to expand the dataset like
date Data
07/01/19 5
07/02/19
09/03/19 10
07/04/19
07/05/19 7

Create another sheet with all of the dates that you need in column A. Then use this formula to look up your Data (column B) against these dates:
=IFERROR(VLOOKUP(A1,Sheet2!A:B,2,0),"")
It will match the desired output you have posted above.

With your data in columns A:B, you can use the following formulas:
D2: =IFERROR(INDEX(ROW(INDEX($A:$A,MIN($A:$A),1):INDEX($A:$A,MAX($A:$A),1)),ROWS($1:1)),"")
E2: =IFERROR(VLOOKUP(D2,$A:$B,2,FALSE),"")
and fill down
note that this formula will fail after 25 Nov 4770, but you'll probably be using a different tool by then :-)

Related

Incrementing a Cell Reference By x

I am trying to average a large data set within Excel where there is data by 30 minute periods for each day of the month. I have a header for 'start date' and 'Start time' which displays 00:00:00 - 23:30:00 for each day, with the data in question in columns to the right. I am trying to develop a formula which averages data which concerns 00:00:00 - 11:30:00 for each day and 12:00:00 - 23:30:00 for each day (AM:PM).
I have one header for AM values and another for PM values, and Im looking to average both these elements for each day of the month
I have used the following formula which does work:
=AVERAGE(OFFSET(C6,24,0,-24))
This formula capture the range from 00:00:00 - 11:30:00 and averages it like I want, but when I drag the formula down to the next cell, C6 increments to C7, but I want it to increment by 48 each time, meaning C6 should become C54. This means when I drag it down each time it will average the AM values for 02/01/2019 and so on.
Is there any way the cell reference in the above formula can increment by 48 instead of 1 each time it is dragged down into another cell?
Sample Data
Expected output
I made up a dataset kind of like yours:
The formula I've used in F4 to obtain the average of values, when date is '01/01/2019' and time is AM, is AVERAGEIFS:
AVERAGEIFS function
My formula is:
=AVERAGEIFS($C$6:$C$101;$A$6:$A$101;E4;$B$6:$B$101;"<"&0,5)
You can use it and just drag down. As you can see in the image above, the formula returns 27,07
The formula will work only with AM because the criteria is "<"&0,5. In the column where you want to do the average of PM times, we would use the same, but changing criteria to ">="&0,5, this means:
=AVERAGEIFS($C$6:$C$101;$A$6:$A$101;E4;$B$6:$B$101;">="&0,5)
Hope you can adapt this to your needs.
NOTE: Because your data is in a Pivot Table (you never mentioned that), if the Pivot Table changes, you'll neeed to adapt the formula. A solution would be using ranges from row 6 until last one, so the formula will take always all the rows. Remember to not show total row or it may affect the result.
OPTION 2: In case you can add an extra column to original data (not in the Pivot Table), maybe this can help a lot.
I've used same data than before, but I added an extra column, named AM/PM with a formula on it:
=IF(B6<0,5;"AM";"PM")
It looks like this:
Then I created a Pivot Table based on it, with a configuration:
Field Start date to section of rows.
Field AM/PM to columns.
Field VALUE to values section, but instead of suming up, I did average operation.
I get this on my Pivot Table:
As you can see, AM for 01/01/2019 is 27,07 (the oher numbers are based on random numbers I made up).
Hope this can help.
If you absolutely must go with the AVERAGE(OFFSET()) solution I would have a 'helper' cell (in this case J6) with 1 in it, then J7 have =J6+48, then the main formula could be
=AVERAGE(OFFSET($C$6,J6,0,24))
Then when you copy the formula down, you'll also need to copy down from J7.
The Rows argument is purpose built for what you want to do. Going to efforts to change the reference cell defies this purpose.
Edited because I missed the AM/PM split:
I think, however, AVERAGEIFS() will fit your requirement better. This takes the average of all values in column C where the date in column A matches that in cell G6 (Change this to wherever your output is). This will avoid errors should any of your dates have any half hour periods missing.
=AVERAGEIFS($C:$C,$A:$A,G6,$B:$B,"<"&TIMEVALUE("12:00:00"))

Excel formula to say if a date range is available/unavailable from a list of date ranges?

I'm creating a booking system in Excel and need a formula to tell me if a given date range is available/unavailable from a list of date ranges (bookings).
There's an excellent article on Chandoo.org here about testing to see if two ranges of dates overlap. However the formula provided only works when comparing one set of date ranges to another single set of date ranges. Whereas I require this to work/search through a multitude of date ranges.
=IF(OR(y<a,b<x),"Do not overlap","Overlap")
Take the bookings below for example:
*Bookings*
Start Date End Date
25/01/2019 26/01/2019
29/01/2019 31/01/2019
01/02/2019 03/02/2019
Based on the above, the following dates are available:
21/01/2019 24/01/2019
27/01/2019 28/01/2019
If I fed the formula either of these two sets of dates, I would expect the outcome to read "Available".
Subsequently, the following dates are unavailable:
23/01/2019 26/01/2019
30/01/2019 02/02/2019
...and the formula should read "Unavailable".
As far as I'm aware, the logic around the formula from Chandoo.org does not work when converted to an array of search/compare criteria.
I thought I came close by using an array within two separate =COUNTIF() statements for each comparison y<a or b<x, however the outcomes weren't always correct.
The fact that a simple formula exists comparing two individual sets of date ranges makes me a believe a more complicated formula is derivable which compares a single date range to an array of date ranges.
Any help or guidance is much appreciated.
Thanks,
Mr J.
I hope this solution will help:
Assuming your actual Bookings are present in columns A&B (I copied your dates into cells A3:B5), and your four potential bookings are in columns D&E (cells D1:E4), you can paste the following formula for the first row:
=IF(COUNTIFS($A$3:$A$5,"<="&E1,$B$3:$B$5,">="&E1)+COUNTIFS($A$3:$A$5,"<="&D1,$B$3:$B$5,">="&D1),"Overlap","Do not overlap")
Drag & copy it to the remaining 3 rows. You should see "Do not overlap" for the first two dates and "Overlap" for the remaining two bookings. Let me know if this is what you were looking for.

Need help optimizing vacation planning Excel (sumproduct of 10000+ rows)

In this picture you can see in column F to H what the raw data looks like and column A to D is what I need (but horizontal).
I transformed the data to show exact dates when employee is on vacation and not date ranges for example:
John 02.01.2018 03.01.2018 04.01.2018 05.01.2018
John 07.01.2018 08.01.2018 09.01.2018 10.01.2018
Tom 01.01.2018 02.01.2018 03.01.2018 04.01.2018 05.01.2018
Tom 07.01.2018 08.01.2018 09.01.2018
Mark 04.01.2018 05.01.2018 06.01.2018
Mark 08.01.2018 09.01.2018 10.01.2018
This way I can use sumproduct to fill my planning table and it works.I managed to do it for managers because the raw data is only 400 rows I use this formula:
=IF(SUMPRODUCT((OFFSET(VMX!$G$2;0;0;COUNTIF(VMX!$G:$G;">""")-1;1)=Planner!$A3)*(INDIRECT("VMX!$O$2:$AS$"&COUNTIF(VMX!$G:$G;">"""))=Planner!G$1)*(OFFSET(VMX!$M$2;0;0;COUNTIF(VMX!$M:$M;">""")-1;1)="X"))>0;"X";IF(SUMPRODUCT((OFFSET(VMX!$G$2;0;0;COUNTIF(VMX!$G:$G;">""")-1;1)=Planner!$A3)*(INDIRECT("VMX!$O$2:$AS$"&COUNTIF(VMX!$G:$G;">"""))=Planner!G$1)*(OFFSET(VMX!$M$2;0;0;COUNTIF(VMX!$M:$M;">""")-1;1)="Y"))>0;"Y";IF(SUMPRODUCT((OFFSET(VMX!$G$2;0;0;COUNTIF(VMX!$G:$G;">""")-1;1)=Planner!$A3)*(INDIRECT("VMX!$O$2:$AS$"&COUNTIF(VMX!$G:$G;">"""))=Planner!G$1)*(OFFSET(VMX!$M$2;0;0;COUNTIF(VMX!$M:$M;">""")-1;1)="O"))>0;"O";"")))
I simplified this formula using name manager to this:
=IF(SPX>0;"X";IF(SPY>0;"Y";IF(SPO>0;"O";"")))
In sheet VMX is the data.
The data ranges should be dynamic because I used offset and indirect but when I try to use this for all employees which is 10k+ rows the excel just freezes.
Does anyone know more efficient way to do this?
First convert your raw data to a table (tblVacDates). Then you can use a formula like this, using COUNTIFS.
=IF(COUNTIFS(tblVacDates[Name];B$1,tblVacDates[Start];"<="&$A2;tblVacDates[End];">="&$A2)=0;"";"X")
Paste the formula to the other columns (don't drag). Then you can copy/drag down

Have A Dynamic Sum Function in Excel

So, I feel like I'm trying to do something fairly simple in Excel here. My company has a Spreadsheet with 2 columns and an indefinite number of rows. Column A is the Date, Column B is a production number for that date. At the bottom of Column B is the total production number. However, every time we update the spreadsheet we have to update the formula to include the newest data on every page. We insert columns for the new dates, so is it possible to have a function that changes based on it's current coordinate? For example something like =SUM(B3:B(CurrentRow-1)).
Use this:
=SUM($B$3:INDEX(B:B,ROW()-1))
It is non volatile and will sum everything from B3 to the row in Column B above where the formula is placed.
Hi You can use the below excel formula to achieve the result you are looking at.
If the values you want to sum up is in column B, then type the below formula and it will show the value dynamically when ever you have added a value to the column.
=SUM(INDIRECT("B2:B"&COUNTA(B:B)-1))

do sum filtered by year

Hi want to create some report using data what I have. Below is what I have.
Date Sold
22-Oct-11 22
23-Oct-11 28
24-Oct-11 10
22-Oct-12 22
23-Oct-12 28
24-Oct-12 10
What I want is create year and sold total as below.
Year Sold
2011 60
2012 87
Any idea how to get this done using excel pre-defined function.
I know this can be done using MACRO, however I don't want to use MACRO.
Edit 1
I don't want to do this using Pivot too. ONLY Excel pre-defined functions.
It's possible to use an array formula (Ctrl-Shift-Enter in formula window to enter, the curled brackets will be inserted by Excel, not by user):
={SUM(IF(YEAR(A1:A4)=2010,1,0)*B1:B4)}
Dates are in column A, sold quantities in column B.
Try this formula: =SUMIF($A$2:$A$7;"=*11";$B$2:$B$7).
I think it's possible to improve this formula, but I'm just a beginner.
If you can add an extra column for =Year(date) then you can use Subtotals to calculate your results (Data-Subtotals)
you can use a pivot table. put the date field on the left, right click and Group by year and put the sold field in the values area
With Excel 2007 (and later), you have access to the SUMIFS function
Assuming your data is in columns A and B, in the order shown, then a function to add up all the data in 2011 would be
=SUMIFS(B:B,A:A,">="&DATE(2011,1,1),A:A,"<="&DATE(2011,12,31))
of course, you can reference a cell containing the year number in place of the 2011 to make it portable

Resources