I have a large excel spreadsheet which has a list of "items" in rows and a value per day in columns (which runs for over 500 columns) - for example refer to example:
sample data
What I need to do is count the number of "A" per week - refer to example:
I can manually get the calculation to work (as per the second image) however due the large amount of data I cant get it to automatically drag across. Any suggestions?
I would suggest you to put extra line to your data table (for me under the line with dates), that will for each column tell you week1/week2/...
The formula for this will be
="Week"&WEEKNUM(B2,1), where B2 = 1.1.2017
Than you can use Countifs formula.
The countifs formula will be:
=COUNTIFS(4:4,"A",$3:$3,B$26)
There line B$26 is value "Week1" from your second chart, line $3:$3 is new line we created before and line 4:4 is line for item2 in first chart.
Then just copy down and right and here you go. :-)
Related
I have a thousands of rows of here data in a spreadsheet (excel 1 image) that I need to create a table with the data populated across the headers below.
If you don't want to use a VBA or spend time with other custom queries, you can do something like this (not, need to create helper column):
Create a helper column that does a count if:
Using this formula:
=IF(B2="Facility ID:", COUNTIFS($B$1:B2,"Facility ID:"),"")
Then structure your data table like this:
And you can use this formula (starting in cell I7):
=INDEX($A:$E,MATCH($H7,$A:$A,0)+I$4,I$5)
Then all you need to do is drag down the rows and increment the counts and it should work provided that the spacings always stay the same and the locations of the fields also stay the same
This solution requires a version of Excel that supports XLOOKUP and Dynamic Arrays.
I would add two columns. One to count records and one to count the line number of the record like so.
E2 is =IF(A2="Facility ID:",MAX(E1:$E$1)+1,E1) and F2 is =IF(E2=E1,F1+1,1). Those formulas are dragged all the way down with the exception of the last row. That is a 6 manually entered because the typical 4th and 5th line are missing from that record.
Then sheet2 looks like this.
A2 counts the number of total rows of data in sheet1. =COUNT(Sheet1!E:E)
Rows 3 and 4 show the positions of each field within the record.
A6 starts a list from 1 to number of records. =SEQUENCE(MAX(OFFSET(Sheet1!E2,0,0,B1))) This uses the dynamic array functionality to spill into multiple cells.
The formula in B6 spills into multiple cells as well.
=XLOOKUP($A6#&B$3,OFFSET(Sheet1!$E$2,0,0,$B$1)&OFFSET(Sheet1!$F$2,0,0,$B$1),OFFSET(Sheet1!$A$2,0,B$4,$B$1),"")
I used OFFSET in the formulas so they can update if additional data is entered.
Finally, copy the formula in B6 to the other columns.
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.
I'm trying to import all data from nth columns, starting from the 3rd row, from one worksheet ('Dataimport') to another ('Cleaned Data') in the same spreadsheet, but so far I have only managed to get a specific cell from every nth column:
=INDEX(Dataimport!$C$3:$HI$3;(ROWS($A$1:A1)*6)+1)
Right now I'm doing it manually, using =TRANSPOSE(IMPORTRANGE("1yyb1k0uAdN1XcLWBhNq4jA0eInnePRoUt9IbuXDmfEU";"Dataimport!I3:I300")) in every cell, so that the column data is imported horizontally (this is how it's supposed to look like):
The sheet with data looks like this. Here I want to retrieve data from every 7th column starting from column C:
Any idea how I do this?
Public link:
https://docs.google.com/spreadsheets/d/1hXFiSoduVjcZ6fbOcyp-BfI7m4So-01umLS0kBm-lVI/edit?usp=sharing
Proposed solution
Given your attempt =INDEX(Dataimport!$C$3:$HI$3;(ROWS($A$1:A1)*6)+1), I would suggest using the Google Sheets Formula OFFSET that allows specifying indexes as mathematical operations.
You will be able to specify the column offset with a simple mathematical operation in order to get the next needed indexes for the rows below.
Here is an example:
=TRANSPOSE(OFFSET(Dataimport!C$2:C$199;1;(ROW()-1)*6;199;1))
With this formula you can obtain the right column form the Dataimport Worksheet and then transpose it in order to fit it in a row.
Putting this formula in the Clean Data "D2" Cell will compute a column offset of 6 starting from the 3rd column ("C") considered in the OFFSET formula. Dragging down the formula will adjust the column offset index to the needed 7 columns range.
Reference
OFFSET
I think I have a solution.
I've build a spreadsheet with dummy data and then I made a formula that takes every nth column from the table.
Here is my solution:
https://docs.google.com/spreadsheets/d/1J6x4H_cNczRRo40Ri6Nwa-YnZOISpxZmG4-JZ7tA1kA/copy
First I make an ID column to both tables to let vlookup work
I use vlookup and arrayformula formula for this:
For grabbing multiple columns I use sequence formula within vlookup.
This makes an array of numbers with defined step. So if you can have every 6th column you define step as 6. Here step is defined in cell c23
=ArrayFormula(vlookup(A24:A43,A2:AB21,sequence(1,5,4,C23),false))
Of course it can work in multiple sheets or files. You just need to use importranges instead of standard references to a range.
In Excel I'm trying to paste in weekly time card reports and then reference the bottom line of each section which contains the yellow highlighted text string in column B (report contains 15-20 sections with variable row differences).
Without using VBA, is there a way to identify an employee ID (Column A), then calculate how many rows below that ID that the last text string cell is located in column B (Highlighted in yellow in the example). Then use that row difference to offset the INDEX formula to grab correct row from the table.
I was using INDEX/MATCH to find the employee ID and then trying to offset the row return per employee manually when I realized that the different job codes rendered that formula inaccurate.
I had used this to reference the proper columns with the offset for one of the weeks, but each week varies. The "+17" at the end of the below formula is where I need the variable row difference to grab the yellow highlighted cell.
=INDEX($A$1:$A$100,(MATCH(A61,$B1:$B$100,0)+17))
Thanks in advance, hopefully I provided the right info to answer the question if there is a solution!
after a revamp of the thought process, the following formula will return the information corresponding to as specific employee and their tax information which is stored in column B in a cell with "EFURTA" in it. No other cell in B within the employee block can contain "EFURTA". If that happens only the first occurence will be returned.
Assuming your data is layed out per the image below, the following formula will return the information you are looking for:
=INDEX(B:B,AGGREGATE(15,6,ROW($A$1:$A$80)/((FIND("ERFUTA",$B$1:$B$80)>0)*(ROW($A$1:$A$80)>MATCH(D2,$A$1:$A$80,0))),1))
Adjust the ranges to suit your data.
If you just want the row number, just grab the aggregate part of the formula and drop the index.
I`m trying to work out a formula, on how to get the MAX amount, for any 30 day consumption period, for a certain item, when all the criteria are in one data table. See picture below. Date is in column A.
I have table with a formula where I copy and paste data manually
=SUM(IF([Date]>[#Date]-30,IF([Date]<=[#Date],[Amount])))
At the end- I would like to have the list of all the item numbers in one column and the one next to it should have - max amount used in any 30 day period.
In my Master file I have around 1300 Item numbers, which is time-consuming to get the MAX data on-by-one.
Can anyone help?
Instead of copy and paste, you can do a pivot table on the data in the first screenshot. Use the dates in rows, use the Amount in values. If you want to do this for item numbers, use them in rows before the date.
You should then have a nice table with dates and amounts per date, no duplicate dates.
If you don't want to use pivot tables, create the date column manually, without duplicates, and use a Sumifs formula to sum the data from the original sheet. Enter the start date, then use the fill handle and drag down. That will automatically increment the date. Let's say the dates are in column A, first row has labels, then use in B2 and copy down:
=sumifs('the other sheet'!H:H,'the other sheet'!A:A,A2)
Next, in C2 you can use a MAXIFS function along the lines of
=MAXIFS(B:B,A:A,"<="&A2-30)