Merge columns from different sheets into specific order - excel

I have an Excel file with three sheets of annual data. For example:
Sheet 1 is for year 2006
Site1 Site2 Site4
Jan 10 12 14
Feb 0 15 9
Sheet 2 is for year 2007
Site1 Site3 Site4
Jan 14 10 18
Feb 4 16 2
Sheet 3 is for year 2008
Site2 Site3 Site4 Site5
Jan 12 13 7 12
Feb 5 13 5 16
In Sheet 4, I want to combine these data under the specific Site_number (if the Site_number is unique, I want to add a column for that data). For example:
Sheet 4 should look like this:
Site1 Site2 Site3 Site4 Site5
2006 Jan 10 12 14
Feb 0 15 9
2007 Jan 14 10 18
Feb 4 16 2
2008 Jan 12 13 7 12
Feb 5 13 5 16
What would be a good way to go about this?

There are very many way of achieving your objective and with the columns apparently already sorted I would be tempted merely to add blank columns until each sheet has each Site in the same column. However instead with a lookup function something like:
=IFERROR(INDEX($C$10:$F$12,ROW(),IFERROR(MATCH(C$1,$C$10:$F$10,0),"")),"")
copied across and down to suit should work, provided Row1 has a complete list of unique Sites and, for the purposes of illustration, your original data is in the same sheet but moved down to start at Row10 and across one column (the latter to allow for manual addition of the year).
I'd suggest one sheet at a time and then merely copy and add/append into a new sheet as required.

Related

Excel: Dynamic Range Date used in other fields: Sumproduct

I am using sumproduct formula to get the first four month, then the second four month, third four month of net sales until one month before today. This is my formula that I used:
=IFERROR(SUMPRODUCT($B3:$Y3*(COLUMN($B3:$Y3)>=AGGREGATE(15,6,COLUMN($B3:$Y3)/($B3:$Y3<>0),1)+4*(COLUMNS(B3)-1))*(COLUMN($B3:$Y3)<AGGREGATE(15,6,COLUMN($B3:$Y3)/($B3:$Y3<>0),1)+4*(COLUMNS(B3)))*($B$1:$Y$1<EOMONTH(TODAY(),-1)+1)),0)
However, I need to capture the same range as I have it for the net sales as for other measures like COGS in my example. I cannot use the formula above for the other measures like COGS as sometimes they are zero in the same range as in the Net Sales.But I need to capture the zeros here as well.
Example 1
Example 2
Net Sales
Jan
Feb
Mar
Apr
May
June
July
Aug
Sept
Oct
Nov
Dec
0
0
2
3
4
5
2
3
2
3
2
4
---> 1st period= 14 2nd period= 10
COGS (follows the same date range as Net Sales)
Jan
Feb
Mar
Apr
May
June
July
Aug
Sept
Oct
Nov
Dec
0
0
0
0
0
2
1
4
2
3
2
4
---> 1st period= 2 2nd Period= 11
You can leave the entire range check logic from the first formula and change just the value range, i.e first formula in my sample:
=IFERROR(SUMPRODUCT($A3:$L3*(COLUMN($A3:$L3)>=AGGREGATE(15,6,COLUMN($A3:$L3)/($A3:$L3<>0),1)+4*(COLUMN(A3)-1))*(COLUMN($A3:$L3)<AGGREGATE(15,6,COLUMN($A3:$L3)/($A3:$L3<>0),1)+4*(COLUMN(A3)))*($A$2:$L$2<EOMONTH(TODAY(),-1)+1)),0)
second formula for COGS:
=IFERROR(SUMPRODUCT($O3:$Z3*(COLUMN($A3:$L3)>=AGGREGATE(15,6,COLUMN($A3:$L3)/($A3:$L3<>0),1)+4*(COLUMN(A3)-1))*(COLUMN($A3:$L3)<AGGREGATE(15,6,COLUMN($A3:$L3)/($A3:$L3<>0),1)+4*(COLUMN(A3)))*($A$2:$L$2<EOMONTH(TODAY(),-1)+1)),0)

Difference between value from multiple sheets

I would like to find the difference between the matched serial numbers from multiple excel sheets
sheet 1
June July
B 10 20
A 50 90
Sheet 2
June July
A 6 3
C 5 9
B 10 5
Sheet 3(results)
June July
A 44 87
B 0 15

PowerPivot Cohort Analysis

I'm trying to do cohort analysis using Excel's PowerPivot. I have a table recording which users have purchased which products in which months eg.
UserID Product Date Quantity
1 Ham Mar 15 2
1 Cheese Jan 15 7
2 Ham Mar 15 8
3 Fish Mar 15 2
2 Cheese Apr 15 8
I want to use a calculated field to filter for a cohort of users who purchased a given product in a given month but be able to analyse all their purchases.
Eg cohort Ham, March 15
--> Users 1, 2
UserID Product Date Quantity
1 Ham Mar 15 2
1 Cheese Jan 15 7
2 Ham Mar 15 8
2 Cheese Apr 15 8
I know this could be done easily using SQL but I am working with colleagues who prefer to use Excel over Access/Some SQL interface.
Thankyou
Create a calculated column like this:
=if([UserID]&SlicerValue=[UserID]&[Product],[UserID])
where HAM would be selected from slicer created from a table of unique products.

Matching multiple criteria (matrix transpose)

In Excel, I want to lookup/index a table that matches both the station_number and the month.
Say I have the following data on sheet1:
Jan Feb Mar Apr May
station1 1 8 17 14 0
station5 4 5 8 10 14
station7 18 7 4 9 10
station10 5 11 15 12 4
On sheet2, I want to fill in the details below:
Station1 Station2 Station3 Station4 Station5 Station6
Jan 1 4
Feb 8 5
Mar 17 8
Apr 14 10
May 0 14
What is the formula I use in order to look up sheet1 and complete sheet2? I tried =VLOOKUP(B1&A2,'Sheet1'!A1:F5,2,FALSE) which is obviously incorrect. Any help would be great.
You should use Hlookup something like following for column station1:
=+HLOOKUP(A2,Sheet1!$A$1:$F$2,2,0)
It should work and hope this helps also.
where sheet1 is the actual source of your input data, but offcourse with every column the references must be change so for station10 column formula would be:
=+HLOOKUP(A2,Sheet1!$A$1:$F$5,5,0)
Please try:
=IFERROR(INDEX(sheet1!$B$2:$F$5,MATCH(J$1,sheet1!$A$2:$A$5,0),MATCH($I2,sheet1!$B$1:$F$1,0)),"")
in sheet2 where your 1 is (assumed to be J2), and copy across and down to suit.

Excel column chart with values per date

I have the following in Excel
Date Connections
2013-10-16 6
2013-10-17 18
2013-10-18 16
2013-10-19 10
2013-10-21 9
2013-10-22 1
2013-10-23 33
2013-10-24 38
2013-10-25 15
2013-10-26 20
2013-10-27 12
2013-10-28 9
2013-10-29 7
2013-10-31 2
2013-11-01 4
2013-11-02 1
2013-11-03 1
2013-11-04 2
2013-11-05 6
2013-11-06 15
2013-11-07 11
2013-11-08 13
2013-11-09 16
2013-11-10 9
2013-11-11 20
2013-11-12 2
I am trying to do a column chart that shows connections per date.
Just selecting the cells and clicking chart gives
I can right click the respective axis and format to get this:
But that only shows the calue for the last date, how do I get it to show all data?
I have googled for a while now but it just seems to add to the confusion.
Turns out that this was due to faulty formatting of the date column when importing the data.
Importing the column as text and then converting it to date and everything works as expected.

Resources