Excel FORECAST function from historical data in multiple row - excel

A B C D E F ...
-------------------------------------------
1| QUARTER 1
-------------------------------------------
2|Week 1 2 3 4 5 ...
-------------------------------------------
3|SALES $500 $300 $100 $280 $600 ...
-------------------------------------------
4| QUARTER 2
-------------------------------------------
5|Week 14 15 16 17 18 ...
-------------------------------------------
6|SALES $200 $100 $300 ???
-------------------------------------------
I have a similar table that stores the Sales revenue data on a quarterly basis
My problem is that the FORECAST formula doesn't allow me select historical data from 2 rows
I have tried the below formula's:
=FORECAST(E6,(B3:N3,B6:N6),(B2:N2,B5:N5))
=FORECAST (E6,(B3,C3,D3,E3...B6,C6,D6),(B2,C2,D2,E2...B5,C5,D5))
None of the above worked. What am I doing wrong?
Secondly, is there way to use FORECAST.ETS or similar function in Excel 2013 via other means like vba or other formula?
Lastly, Is it possible to skip/consider Holidays period, where office is closed for over a month?

Following are the changes required in the data and the formulas.
(B3:N3,B6:N6) and (B2:N2,B5:N5) are not in one continuous row or column.
You need to change the way data is entered to B3 to AA3 and B2 to AA2, and then change the corresponding formula to (B3:AA3) and (B2:AA2).
Even if you use a Name for the range, instead of cell reference, it has to be one continuous range of Row or Column. Blank (and Text) values of Known_Xs and Known_Ys are ignored. However both X and Y ranges have to be equal in length.
Your attempt to use the formula using cell names instead of ranges also cannot work. It will work only if cell refences are replaced with values. After you test the formula, select the range, example B3:AA3 and click F9. The cell references will be replaced with numerical values, and the formula will still work.
I hope this will give you a better clarity of what you need to change to make your formula work properly.
Regards,
Vijaykumar Shetye,
Spreadsheet Excellence
Panaji, Goa, India

Related

How to keep excel formula consistent with inserting new columns

In my sheet, my top row is a bunch of dates and I have columns separating the weeks.
| 1.1 | 1.5 | 1.12 | 1.29 |JANUARY TOTAL| 2.3 | 2.15 | FEBRUARY TOTAL|
----------------------------------------------------------------------
Below each date is the number of hours worked on a project, and in each "MONTH TOTAL" column is a sum of the time worked on each project per month.
When I created this spreadsheet, I put in a filler of 2 blank spaces, but since I can't predict when I'll be working on each project, I have to rely on inserting new columns if I decide to work on something on a day that isn't preset into the sheet.
The problem is that my formulas don't extend all the way to the MONTH TOTAL columns when I insert new columns. For instance, when I create my spreadsheet, my formula for one of the totals in the MONTH TOTAL column would be "=SUM(B2:C2)" but when I insert two more dates I need the formula to be "=SUM(B2:E2)".
Is there a way to encapsulate inserted cells into a formula so that it sums between a bound of two columns and any new inserted cells?
You can use the INDIRECT function coupled with ADDRESS, ROW, and COLUMN.
In your stated example, let's assume your "MONTH TOTAL" formula is in D2 and currently contains =SUM(B2:C2). You will want to update the formula to:
=SUM(B2:INDIRECT(ADDRESS(ROW(),COLUMN()-1)))
Whenever you insert a new column, it will still SUM by referencing the values in the preceding columns.

Sumif Function involving dates and text

I have a three columns which contain a range of dates, ie 6/15/2013, corresponding items ie. gravel, asphalt etc and corresponding tonnages. I need to be able to sum all of the tonnages of asphalt per month.
I have tried several sumif statements but they are all coming back with no value. Everything was going fine until I tried to add the sorting by month "if" statement.
Any help is appreciated.
Sample Data below
Column A | Column B | Column C
6/23/2013| Asphalt | 12
7/14/2013| Asphalt | 14
6/15/2013| Gravel | 15
8/15/2013| Gravel | 18
6/3/2013 | Asphalt | 14
thanks
If you have Excel 2007 or later try using SUMIFS, e.g. in F2
=SUMIFS(C:C,B:B,"Asphalt",A:A,">="&E2,A:A,"<"&EOMONTH(E2,0)+1)
where column A contains dates, B items and C tonnages....and E2 should contain the 1st of the month for which you want to sum. You can add more more dates in E3 down and then copy that formula down

Cross referencing Excel worksheets

I'm working with 3 worksheets.
PROJECTS consists of the following:
Project ClientCode Code
------ ---------- ----
Project1 ABC 123
Project2 ABC 456
Project3 DEF 789
INVOICES consists of:
ProjectCode Amount
----------- -----
123 $100
789 $200
123 $50
And CLIENTS consists of:
Code Total
---- -----
ABC [$150]
DEF [$200]
I'm trying to create a formula which will populate the "Total" field on the client sheet by determining which invoices belong to which project belong to which client. I feel like it would be a combination of SUMIF and LOOKUP, but I'm stumped.
EDIT: Revised the above to the format discussed below (swapped Projects column B and C)
Using VLOOKUP and SUMIF in a single cell without any helper column is possible, but you will need to interchange the positions of columns ClientCode and Code in PROJECTS for it to work.
Interchange the column positions as mentioned above (so that ClientCode is before Code), then use:
=SUMIF(INVOICES!A:A, VLOOKUP(CLIENTS!A2, PROJECTS!B:C, 2, 0), INVOICES!B:B)
I'm assuming that row 1 of each worksheet has the column headers. A2 here refers to ABC.
VLOOKUP first looks for the Code of the ClientCode and SUMIF then sums the amounts of matched Code in the INVOICES worksheet.
EDIT: Below should work better since VLOOKUP finds only the first match, which doesn't work here.
=SUM(SUMIF(INVOICES!A:A,IF(CLIENTS!A1=PROJECTS!C:C,PROJECTS!B:B),INVOICES!F:F))
Note that you have to use Ctrl+Shift+Enter to use this formula. After you did it for ABC, you can drag the formula to B. Also note that his formula can take some time to evaluate, and as such, it might be better if you change the ranges to an appropriate range. For example, if INVOICES has only 100 rows, change INVOICES!A:A, INVOICES!B:B to INVOICES!A2:A100, INVOICES!B2:B100, same goes for the other ranges in this formula.

defining variables in excel formulas?

i have a simple table data like:
date | Jenna | Tom | Robin
01/01/12 2 5 8
02/01/12 3 4 7
(date columns starts from the first day of the year and goes all the way down to he next year.)
I have a formula getting the min. and max. values (for example for Jenna) for the month January.
I have to change the row numbers every month to get the right result.
Is it possible for me to define variables in two cells and use them in that formula without using VBA.
For example;
I will put two values in H1 and H2 cells, which are 28 and 58 respectively. And i will define E1 as start and E2 as end. And write down this formula:
=min(Cstart:Cend)
=max(Cstart:Cend)
=average(Cstart:Cend)
The first formula means to get the min value between the C28 and C58.
That way i will not have to change every formula manually on the page. I will just change the values of 2 cells and that will be enough.
I hope, I have explained.
Sure. You have to use the INDIRECT() function. INDIRECT transforms a string to a range reference.
=MIN(INDIRECT("C" & $H$1 &":C" & $H$2))

Sum values in a column based on date

I have written this function that will give me a monthly sum for two columns: one has the date of each order, one has the cost of each order.
=SUMIF($C$1:$C$1000,">="&DATE(2010,6,1),$D$1:$D$1000)-SUMIF($C$1:$C$1000,">="&DATE(2010,7,1),$D$1:$D$1000)
Using data like this:
8/16/10 17:00 7.99
8/16/10 14:25 7.99
8/15/10 22:42 7.99
I end up with a table like this:
May 998
June 968.28
July 1239.76
August 514.96
However, now I would like to do daily sums and using my way I have to hand edit each row.
How can I do this better in Excel?
Use a column to let each date be shown as month number; another column for day number:
A B C D
----- ----- ----------- --------
1 8 6 8/6/2010 12.70
2 8 7 8/7/2010 10.50
3 8 7 8/7/2010 7.10
4 8 9 8/9/2010 10.50
5 8 10 8/10/2010 15.00
The formula for A1 is =Month(C1)
The formula for B1 is =Day(C1)
For Month sums, put the month number next to each month:
E F G
----- ----- -------------
1 7 July $1,000,010
2 8 Aug $1,200,300
The formula for G1 is =SumIf($A$1:$A$100, E1, $D$1:$D$100). This is a portable formula; just copy it down.
Total for the day will be be a bit more complicated, but you can probably see how to do it.
Use pivot tables, it will definitely save you time. If you are using excel 2007+ use tables (structured references) to keep your table dynamic. However if you insist on using functions, go with Smandoli's suggestion. Again, if you are on 2007+ use SUMIFS, it's faster compared to SUMIF.
Following up on Niketya's answer, there's a good explanation of Pivot Tables here:
http://peltiertech.com/WordPress/grouping-by-date-in-a-pivot-table/
For Excel 2007 you'd create the Pivot Table, make your Date column a Row Label, your Amount column a value. You'd then right click on one of the row labels (ie a date), right click and select Group. You'd then get the option to group by day, month, etc.
Personally that's the way I'd go.
If you prefer formulae, Smandoli's answer would get you most of the way there. To be able to use Sumif by day, you'd add a column with a formula like:
=DATE(YEAR(C1), MONTH(C1), DAY(C1))
where column C contains your datetimes.
You can then use this in your sumif.
Add a column to your existing data to get rid of the hour:minute:second time stamp on each row:
=DATE(YEAR(A1), MONTH(A1), DAY(A1))
Extend this down the length of your data. Even easier: quit collecting the hh:mm:ss data if you don't need it. Assuming your date/time was in column A, and your value was in column B, you'd put the above formula in column C, and auto-extend it for all your data.
Now, in another column (let's say E), create a series of dates corresponding to each day of the specific month you're interested in. Just type the first date, (for example, 10/7/2016 in E1), and auto-extend. Then, in the cell next to the first date, F1, enter:
=SUMIF(C:C, E1, B:B )
autoextend the formula to cover every date in the month, and you're done. Begin at 1/1/2016, and auto-extend for the whole year if you like.
If the second row has the same pattern as the first row, you just need edit first row manually, then you position your mouse pointer to the bottom-right corner, in the mean time, press ctrl key to drag the cell down. the pattern should be copied automatically.

Resources