So I'm trying to create a Forecast using historic data from 2 years. Each year's data is broken down into weeks and weeks that haven't occurred yet are set to 0. I'm struggling trying to create a formula that will automatically run a Forecast on only the weeks in the year that have occurred. I created this formula which Excel won't execute:
=UNIQUE(FILTER(WkSht!G:(VLOOKUP(F1,DH2:DI54,2)),(WkSht!A:A)=(B1)))
I'm trying to use VLOOKUP to replace the second part of a cell reference based off a lookup table. So if F1 is 25, for example, then the Filter function will be:
=UNIQUE(FILTER(WkSht!G:AE,(WkSht!A:A)=(B1))
That second formula works on its own as intended, but I'm trying to create this excel file so that it requires minimal work to update in the future and manually changing the range seems like a bit too much work to expect other people to do.
So I guess my question is:
How do I change part of the reference automatically?
Maybe I could do:
=UNIQUE(FILTER(VLOOKUP(F1,DH2:DI54,2)),(WkSht!A:A)=(B1)))
And have to lookup values contain the reference text?
Alternatively, is there a way to filter out the last of the 0's in the FORECAST.ETS function (as some values might intentionally be 0s in earlier weeks)?
To get a variable width range, you can use the construct
SomeRange:INDEX(MaxRange,,NumberOfColumns)
In your case SomeRange would be
WkSht!G:G
MaxRange would be something like
WkSht!G:Z
where you replace Z with a column that comfortably covers all your (future) data
NumberOfColumns is your VLookup (You probably want an exact match?, If so include the 4th parameter =0)
Demo:
=UNIQUE(FILTER(WkSht!G:G:INDEX(WkSht!G:Z,,VLOOKUP(F1,DH2:DI54,2,0)),WkSht!A:A=B1))
Sample data on sheet WkSht
Related
I have many formulas that reference a large list and at the time I just have them to 1000 to make it easy. There will come a day that I will surpass 1000 and I don't want to have to continuously update the function but at the same time I don't want to have an excessive range.
The following function is in cell CM4 and I have data in cells CM11:CM52 and each day one more gets added at the bottom. What kind of function could I use to just take the average of CM11:CM52 that will reference CM11:CM53 tomorrow and so on and so on?
The following formula is a simple one that is in my worksheet:
=AVERAGE(CM11:CM1000)
Many formulas do not have a cost to using full column references. AVERAGE() is one of them so there is no problem using
=AVERAGE(A:A)
Or if you want to start on a certain row:
=AVERAGE(CM11:CM1048576)
For those formulas that do matter ie Array Types then we can make it dynamic with INDEX/MATCH
=AVERAGE(CM11:INDEX(CM:CM,MATCH(1E+99,CM:CM))
If the column in question is text then use "zzz" instead of 1E+99
I would suggest adding your data to a table (insert>table). This will allow the formulas to update automatically.
So I have a data set converted from a stock chart in 1 minute time increments and I want to extract key data points from the data set.
screenshot
The problem I am running into is when I attempt to use the INDEX function to match the MAXIF and MINIF results, the time criteria does not follow through:
The first function to extract the Low of Day from this data set:
=MINIFS(E:E, B:B, ">09:30", B:B, "<16:00")
The second function I'm attempting to pull the time of when the Low of Day data point is pulled from:
=INDEX(B:B,MATCH(MINIFS(E:E, B:B, ">09:30", B:B, "<16:00"),E:E,0))
The result I get is 8:52 AM, which is outside of the time criteria I have set. It appears that the function seems to pull the very first instance that matches the MINIF function result, disregarding the time criteria altogether.
So also I want to keep in mind that I want to use a function that does not rely on hunting down individual cells as I'm hoping the end goal is to automate a data extraction process to export all the significant data points into a new excel sheet, and doing this over the course of several hundred to thousands of data sets.
Ideally I'd like to have a function that can reference the exact data point that was first extracted to pull other significant data from the same row and avoid possibly referencing the wrong data point just because it's a duplication elsewhere.
Try the following array formula, which needs to be confirmed with CONTROL+SHIFT+ENTER...
=INDEX(B2:B10,MATCH(SMALL(IF(B2:B10>"09:30"+0,IF(B2:B10<"16:00"+0,E2:E10)),1),IF(B2:B10>"09:30"+0,IF(B2:B10<"16:00"+0,E2:E10)),0))
...and adjust the ranges accordingly. For efficiency, though, I would suggest that you avoid whole column references.
If the range grows over time, consider converting your data into a Table. The references will automatically adjust as rows are added or removed.
Notice that +0 is added to the time. This is to coerce the string value into a true time value.
EDIT
Since it looks like you don't want to convert your data into a Table, here's an alternative that uses defined names instead. Here too, the ranges will automatically adjust as rows are added/removed. Note that it uses Column B to determine the last row.
First, define the following names (change the sheet names accordingly)...
Name: LastRow
Refers to: =MATCH(9.99999999999999E+307,'Sheet 1'!$B:$B,1)
Name: TimeColumn
Refers to: ='Sheet 1'!$B$2:INDEX('Sheet 1'!$B:$B,LastRow)
Name: LowColumn
Refers to: ='Sheet 1'!$E$2:INDEX('Sheet 1'!$E:$E,LastRow)
Then try the following formula, which needs to be confirmed with CONTROL+SHIFT+ENTER...
=INDEX(TimeColumn,MATCH(SMALL(IF(TimeColumn>"09:30"+0,IF(TimeColumn<"16:00"+0,LowColumn)),1),IF(TimeColumn>"09:30"+0,IF(TimeColumn<"16:00"+0,LowColumn)),0))
I have an excel worksheet which captures hours spent by resources for tasks for each work day. The input sheet looks like this -
I need to pull a report based on this data to gather number of hours filled by each resource on each day between a date range (specified by a start and end date). Sample output looks like this -
I have tried using SUMIFS but it fails to give me an output as the row/column range for all conditions and the sum range needs to stay same, which is not same for my case.
Can someone suggest an alternative to get required data?
SUMIF will work for you but you need a dynamic sum range.
This bit can help you achieve that:
=SUMIF($A$2:$A$9,$A15,INDIRECT(CHAR(64+MATCH(B$14,$A$1:$G$1,0))&"2:"&CHAR(64+MATCH(B$14,$A$1:$G$1,0))&"8"))
Most important part is CHAR(64+MATCH(B$14,$A$1:$G$1,0)) which searches position of your date and converts it into column name.
I used 2 and 8 as indicator for the beginning and end of sum range and wrapped everything with INDIRECT to convert string to cell reference.
I've come across several discussions on using INDIRECT and 3D references, however none seem to address (or fix) this problem specifically.
I'm trying to count the position of a worksheet without using VBA. Each sheet represents a month, and has a standardized name (e.g. JAN-15, FEB-15, MAR-15, etc.). My idea is to find the position by counting the number of sheets between JAN-15 and the current sheet. A1 of each sheet = 1, which gets summed across the sheets using a 3D reference.
Using February as an example, I can hard code this with no problem:
=SUM('JAN-15:FEB-15'!A1)
When I do this, I get the expected result of 2. However, I want each month's sheet to dynamically generate its position without having to change the formula each time. So I tried this:
Cell named FIRSTMONTH ='JAN-15
Cell named CURRMONTH =RIGHT(CELL("FILENAME",A1),6)
N1 =CONCATENATE("'",FIRSTMONTH,":",CURRMONTH,"'!A1")
(N1 evaluates correctly as 'JAN-15:FEB-15'!A1)
When I try this formula to generate the position:
=SUM(INDIRECT(N1))
I get a #REF! error. I've also tried this variation:
=SUM(INDIRECT("N1"))
Which returns 0.
Anyone have an idea of how I can get this to work? Or is there a better way that doesn't use VBA?
-David
Assuming you won't have any gaps perhaps try counting the number of month between the first month and the current one, e.g.
=DATEDIF(FIRSTMONTH,CURRMONTH,"m")+1
I was wondering if you could help me with a request. I used a custom script that dynamically creates one half of a cell reference, and I use a ROW formula to calculate the other half of the reference. The problem is, I'm trying to use that generated reference in a SUM calculation, but I am having issues using the correct syntax.
In essence I'm trying to create a formula that I can drag down 112 columns and save myself having to do the same thing multiple times. The script I made uses the following formula to create the column letter:
(averageTimeCalculator(U88) - U88 is just a field I'm using for the sake of testing this formula out, and it works perfectly. The second half of the reference is created by just taking the row of whatever the formula itself is on, so in this case:
ROW(Z88)
Using CONCAT I put the two together "=(CONCAT(averageTimeCalculator(U88),ROW(Z88)))" which gives me the result: F88. What I'm trying to do with that reference is find out the sum of all the values on that row, leading up to it, so in essence I'm trying to create a formula that represents =SUM(A88:F88), in a way that I can drag it from A:3 to A:114), but everything I have tried to this point has thrown some sort of parsing error.
I've been throwing myself at this problem for a few hours now, using variants of the following syntax:
=SUM((C88):CONCAT(averageTimeCalculator(U88),ROW(A88)))
but I can't get it to work :( can anyone help?
You can use SUM(INDIRECT(A89)) where cell A89 would contain the text "A88:F88".