I have an excel dataset with a rows and 5 columns per row.
I need to transpose so that all data is in rows with just two columns:
each row must have Column 1 from the dataset in its column 1 and each of the columns 2-5 in the dataset as its column 2, when those are exhausted row 2 of the dataset is processed in the same way. This would result in each row in the dataset creating 4 rows in the transposed set.
To better explain I have added in some screenshots of what I mean.
unfortunately i cannot access VBA or macros on our machines so it needs to be a formula.
Sorry posted before I'd completed the question:
I have tried using a variation of =row() and =column() to try to count columns and then move to the next row when column number is more than 5 but I'm struggling to work out the logic that would work.
I've also toyed with =index with the entire dataset as an array and use some calculations to give the function the pointers to the row and column to next display.
But as an array its pretty slow when dealing with 10,000 records (and I still haven't worked out what logic I would use).
You are on the right track with Index and Row
In you unpivot sheet, use
A1
=INDEX(Source!$A:$A,INT((ROW()-1)/4)+1)
B1
=INDEX(Source!$B:$F,INT(ROW()-1)/4+1,MOD(ROW()-1,4)+1)
Related
I have the following formula:
=INDEX(TODAY!$D$2:TODAY!$D$306; MATCH(0; COUNTIF($A$2:$A2; TODAY!$D$2:TODAY!$D$306);0))
in the above example 306 is the number of ROWS in D column of the TODAY sheet that I get from the following formula:
=COUNTA(TODAY!D2:TODAY!D2000)
I can't figure out how to merge these two formulas together, so that in A column I get unique values for number of rows generated by second formula. Because if I copy the first formula along the A column it starts repeating from the beginning same values.
For example, what happens now is if I have 5 unique records in TODAY sheet but i copy the formula in 10 rows of A column it repeats those 5 records again. But I need to get only 5 records, others must remain blank.
Thank you!
One approach is to use OFFSET.
Here's a list of animals and we want to count horses and the list can grow but it's fixed on A2:A12.
To make it dynamic use OFFSET and your COUNTA formula e.g.
OFFSET(A2,0,0,COUNTA(A2:A40))
Which replaces the fixed A2:A12 range in the example.
At some point, approximately 2,000 rows out of a total of 15,000 rows of data got messed up in Excel, and we only noticed it much later. We now have the correct data, and want to update only the incorrect 2,000 rows.
We have Sheet 1 with 15000 rows and Sheet 2 with 2000 rows, each with Columns A and B. In both Sheets, Column B will match, but Column A will only have approximately 2000 matches.
What I am looking to do is update Column A of Sheet 1 with the correct data from Column A of Sheet 2 based on matched data in Column B from both sheets.
Presumably, a VLOOKUP is the way to go, but I can't seem to get the syntax right. Any help would be greatly appreciated!
I've fixed it!
Truth be told, I gave up on using a VLOOKUP and used INDEX & MATCH instead. The actual formula I used was:
=IFERROR(INDEX(Sheet2!A:A,MATCH($E2,Sheet2!$C:$C,0)),D2)
Since I was trying to match data in one column and fetch data from a different column in the results, this seemed simpler.
Apologies if I wasted anyone's time!
My problem seems trivial … but I have stacked in Excel.
I have a really big data sheet and to be able to work with it I applied 3 first rows as frozen (not all cells in this range are filled but sometimes it looks like:
C1: Shop1,
C2: year,
C3: cashier
....data1
....data2
). Then I add there a filter and when data is filtered, I can see only the first row – without row 2 and 3.
Is there any way how to make the frozen rows, frozen also for filtering? Like “untouchable” headers?
Thanks for any answer
You need to input the filter starting in row 3, in other words, select the entire row number 3 in your data table and click on filter. This way you maintain the top 3 rows when you filter your data.
A work around for this could be.
split the view for the top three rows and then create filter on the first row, considering each cell of the first row can be used as column header.
Then you can use the lower part of the split view to work and the top three rows will always be there.
This though not optimal but a quick solution for large sheets with more than 3-4000+ rows of data.
Hope this helps.
I have 2 worksheets, one with multiple columns of data where rows are given years and the other columns are values under the headers of names, and the second sheet lists rates by year (column) and by name (row).
I am trying to take each value in a given column of sheet1 and multiply it by the relevant rate (found by matching the year of each row and the name of its column to the table in sheet2) and then sum the products by name, but can only use a single cell to do all this.
So far I've tried SUMPRODUCT and got to =SUMPRODUCT(O$24:O$514,INDEX(Rates!$A$2:$X$200,MATCH(O$23,Rates!$A$2:$A$67,0),MATCH($D$24:$D$514,Rates!$A$2:$X$2,0))) but this seems to fall down at the MATCH($D$24:$D:$514,Rates!$A$2:$X$2,0) part, even entering as an array.
I've currently resorted to a clumsy series of SUMIF(2016)*INDEX/MATCH(2016 rate)+SUMIF(2015)*INDEX/MATCH(2015 rate) etc, but would really like to have forward compatibility without relying on formulae being updated!
slightly simplified image of the workbook, thanks for any help!
I have an employee data base that contains names and 8 movement types (Ex. Recruitment, Resignation....etc). Also I have starting head counts.
What I need to do is calculating movement counts and head counts based on the month for 12 months. Currently i am using SUMIF formula to calculate all these and the thing is excel will be very slow with all formulas. Appreciate if anyone can help me on this. See the image below for sample of the formula and I need to insert this formula in more than 600 lines.
A pivot table would be a good way to go, but by the look of your criteria you'll need to create 'helper columns' to ensure your data is ready for aggregation in a Pivot table.
For instance in your master data tab, add a new column called 'MatchesCriteria' or words to that effect, and build a formula in that column that checks for all of the criteria that you want to have the report based on, and returns a 1 or a 0, e.g.
=IF( (IF(C2="Recruitment",1,0)+IF(D2="Secondment In",1,0)) > 0 , 1 , 0)
Then run a pivot table including the 'Plant' column in your Rows, the month column in your columns and the 'MatchesCriteria' in your data values, and switch the calculation type to 'SUM' rather than 'COUNT'.
This will do the trick and will refresh in a flash compared to evaluating all of those countif statements.