How to align offices in excel based on the number of months it has been open? - excel

The data I have has multiple offices (600+) with different opening dates as the years have gone on. However, we frequently need to do analysis where we line up everything based on how long it has been open. For example, what is the average revenue performance of an office in it's first 6 months of opening. We have manually been lining up every office so that each month 1 is together, but there has to be an easier way?
Data example:
Offices & Open Dates:
Office X- 03/07/2012
Office Y- 5/19/2014
Office Z- 12/01/2009
I need the revenue to line up as follows
Column A
Office X
Office Y
Office Z
Column B - Month 1 Revenue
Revenue for 03/2012
Revenue for 05/2014
Revenue for 12/2009
Column C - Month 2 Revenue
Revenue for 04/2012
Revenue for 06/2014
Revenue for 01/2010
Column D - Month 3 Revenue
Revenue for 05/2012
Revenue for 07/2014
Revenue for 02/2010
etc.
Any ideas on how to do this?
Thank you.

My comment mentioned using index and small in an array formula to extract the data if the revenue data is sorted by date. Array formulas can be tricky and having to keep the data sorted is a pain so I've had another idea.
If you are able to add a new column in your revenue data, preferably before the revenue value, then you can create an id that can be used with a simple vlookup to extract the data you need.
Let's assume that your office name is in column A, your revenue date is in column C and revenue value is in column D
You can use the formula below to create a unique id for each revenue month
=A1 & " MONTH " & countifs($A$1:$A$20,A1,$C$1:$C$20,"<="&C1)
=A1 gets the office name to use in the id and then we add the text " MONTH " to the office name.
The countifs part counts all the revenue dates with the same office name that are the same or older (so it counts itself and returns 1 for the oldest then 2 for the second oldest etc.)
We end up with an id column something like this
Office Name 1 MONTH 1
Office Name 2 MONTH 1
Office Name 1 MONTH 2
As you have 600 offices it could be a little bit slow so you could copy and paste as values once the formula has done it's work.
Now that you have this id column you can use it to extract the revenue data by month using a vlookup and if you have a list of offices and headings MONTH 1, MONTH 2, MONTH 3 along the top then you can automate the creation of the vlookup required to extract the data you need.
So if the office names are in column F and the headings start in column G the formula below can be autofilled across and down to extract the required values. Notice that the $F column for the names has the column locked and the heading value in G$1 has the row locked because the $F2 & G$1 create the id "Office 1 MONTH 1"
=iferror(vlookup($F2 & G$1,$B$1:$D$20,3,false),"")

Related

Values of different time periods summed up and matched to certain dates

I have the following Excel spreadsheet.
The spreadsheet is used to plan sales campaigns. The user enters the start and end date of the sales campaign in Column B and Column C. In Column D the duration (number of days) is calculated from those dates. In Column E the user enters the revenue for the entire campaign. In Column F:L the user divides the revenue over the days of the duration.
In Column N each day of the year is listed.
In Column O the sum of the revenue based on the values in Column F:L should be calculated.
For example Campaign A starts at 2018-01-01, takes 4 days and therefore 300€ go to 2018-01-01, 100€ go to 2018-01-02 and so on ....
The same applies for all following campaigns.
Therefore, in Column O the sum of the revenue of all campaigns should be calculated so on 2018-01-02 to the 100€ from the second day of Campaign A the 120€ from the first day of Campaign B should be added. Thus, the total is 220€.
Do you know a formula that I can use in Column O which does exactly the calculation described above?
Sumproduct will iterate through testing whether the date is in the range, find where it lands in that range and return the correct value to be summed.
=SUMPRODUCT((N2<=$C$2:$C$5)*(N2>=$B$2:$B$5)*("Day " & N2-$B$2:$B$5+1 = $F$1:$L$1),$F$2:$L$5)

Need help referencing another excel sheet cell based on date

I am trying to build a workbook with 4 tabs for a small business.
There are 3 locations, and the first tab will be a scorecard of sorts.
So, on the first tab (named scorecard) I have something like
Date: August 30, 2017
loc sales
location 1 500
location 2 500
location 3 500
the other 3 tabs are names loc1,loc2,loc3 and each one is set up for 31 days going vertically like:
1 500
2 500
3 500
what I want is for on the scorecard sheet, to be able to select a cell on say loc1 sheet based on the date. I know how to reference other sheets, I just don't know how to reference a specific cell on the second sheet bases on the date entered in the first sheet.
So say today, August 30, it would pull =loc!1B30 for sales, =loc!C30 for customer count etc
I hope that makes sense, if not I can try and explain better
Is each cell for sales amount associated with a date? If so, you can use a "VLOOKUP" formula. Check out this page for a further explanation.
https://www.techonthenet.com/excel/formulas/vlookup.php
Using VLOOKUP, the "value" would be the cell of the date on the scorecard tab, the "table" would be the dates and sales values on the locX tab, the "index number" would be the column number in the table you select (probably 2 for you I assume if there is a date, then value), and the last portion of VLOOKUP would probably be set to false. That would be true if there were several of the same date for sales, but I doubt that from what I understand.
It would look like this:
=vlookup([date cell reference],[table to look up value in],[column number in table],false)

Excel SUMIFS Statement - Calculate profit for each month across multiple years

I've got three columns of data.
Sell Date - Column G - Contains the day, month and year in dd/mm/yyy format.
Month (calculated from sell date) - Column I - Contains month number
Profit - Column M - Profit in Dollars.
I am trying to calculate the profit made in each month and year.
Current formula using SUMIFS. I look at the data in Column I and if this contains a 1, and if G contains the year 2016 then it's January 2016. Think it's the year function that I don't quite get.
=SUM(SUMIFS(M9:M50, I9:I50, {"1"}, G9:G50, YEAR=2016))
You can create another column that shows just the year year(G2) or you can use this formula
=SUMIFS(M9:M50,G9:G50,">=1/1/2016",G9:G50,"<1/2/2016")
I also like this formula that allows you to reference the date in one cell and calculate a 1 month range. Put 01/01/2016 in cell A1 and the formula does the rest.
=SUMIFS(M9:M50,G9:G50,">="&A1,G9:G50,"<" & EDATE(A1,1))
The SUMIFS function doesn't like it when you alter the value of the IF parameters. It would be better to use a SUMPRODUCT formula to calculate this, for example:
=SUMPRODUCT((M9:M50)*(I9:I50=1)*(YEAR(G9:G50)=2016))
Where:
(M9:M50) are the values you wish to SUM.
(I9:I50) are the month values and 1 is the month you wish to specify.
(G9:G50) are the date values you wish to obtain the year from and 2016 is the year you are specifying.

Excel: Index match if date matches month?

I have two excel sheets:
Data:
Column A Column E
01/01/2017 Supplier 1
05/01/2017 Supplier 2
05/01/2017 Supplier 1
Sheet 2:
I am trying to look up the supplier where the month of the date in column A matches the month number in cell F11.
F11 = 1
=IF(ISERROR(INDEX(Data!$A:$I,SMALL(IF(MONTH(Data!A:A)=$F$11,ROW(Data!$A:$A)),ROW(1:1)),5)),"",INDEX(Data!$A:$I,SMALL(IF(MONTH(Data!A:A)=$F$11,ROW(Data!$A:$A)),ROW(1:1)),5))
For some reason this doesn't work and i get no result.
I also need to only list each supplier name the once, unique values. But i believe my formula gives me the same result twice.
Please can someone show me where i am going wrong?
Can't you do this with a pivot table?
Just drag the date field into the columns box, then right-click, choose 'Group' and choose 'months'. Then drag the supplier field underneath it and you should get a list of all unique suppliers by month.
Edit:
Example below.

Extracting the month value from date field array

I have a spreadsheet with two columns of dates when a customer expressed interest in buying an item and a column of dates when the sale was actually made. I am trying to sum the total amount of sales when the month on the interest matches the month of the sale. For example:
Date of Interest Date of sale Price
04/15/2015 04/15/2015 $4,795
04/09/2015 04/27/2015 $3,596
03/31/2015 04/22/2015 $6,477
04/16/2015 04/28/2015 $9,755
The formula I am trying to use is this
=SUMIFS(E2:E15,MONTH(C2:C15),H2,MONTH(F2:F15),H2)
Where E2:E15 is the column of sales amount
C2:C15 is the date of interest
F2:F15 is the column of date of sale
H2 is a field that contains a month number (4 for this example)
If the formula worked, it should return a value of $18,146 (the sale of $6,477 would not included as the interest date was in month 3)
However, I get an error with the formula (no specific information). Is there anyway to extract the month number from both columns within this formula? I can create additional columns that have the month number and if I use them the formula works.
Any help would be greatly appreciated
Try:
=SUMPRODUCT((MONTH(Lead_date) = MONTH(Sold_Date))*Sold_Amt)
or:
=SUMPRODUCT((MONTH(Date_of_Interest)= MONTH(Date_of_sale))*Price)
If you want to restrict your answer to the month number contained in H2, as suggested by #user3578951, then simply modify the above to add that factor:
=SUMPRODUCT((MONTH(Date_of_Interest)= MONTH(Date_of_sale))*(MONTH(Date_of_Interest)=H2)*Price)
If you create a helper column to create a column of months (in number form), you can use your formula. Just insert a column next to your two date columns, and use =Month(C2) and drag down. Then you can just use =sumifs(e2:e100,_[lead date helper month range]_,h2,_[sold date helper month range]_,h2).

Resources