I have 1000 rows and have a single column, single criteria. I want to do countif for this data for a set of 50 rows at one time. How do I update the row number automatically so that I don't need to enter the range manually everytime?
Additional information (from comments):
I have a set of values (9-100) in a single column and 1000 rows. I want to use >= 18 for every 50 rows so that it tells me how many cases within each set have a value greater than 18 . I do not want to manually enter the range in the countif function every time.
you can use this one:
=COUNTIF((INDIRECT("A"&(ROW()-1)*50+1&":A"&(ROW()-1)*50+50)),">="&18)
fill down 20 cells; then you will have countifof the every 50th range.
Related
I've faced huge problem with my macro. I have data that contains colums with quantities and values of stock like this:
What I'm trying to achieve is:
to go through every row until the very last, locate quantity (colums with Q letter) and values (colums with V letters) below 0, then adding these quantities below zero to the maximum quantity within the row and adding these values below 0.
to find values within age category for every row that have no corresponding quantity (see cell B4 as example) and add these values to the maximum value within the row.
Why VBA for something you can achieve with a formula?
Let me show you how I calculate the maximum of a list of cells, referring to a column, whose name starts with a "V":
=MAXIFS(A2:F2,A1:F1,"V*")
Screenshot:
Explanation:
Take the maximum of the values on the second row (A2:F2)
The criteria you need to take into account refer to the first row (A1:F1)
The criteria is that it should start with a "V".
I have a column that has data added everyday, but I only ever need to pull the last 30, to effectively give me a "Rolling 30 Day" view of the metric. How do I pull just the most recent (lowest in the column) 30 entries?
In SQL it's something a simple as "SELECT * FROM table ORDER BY id DESC LIMIT 30", but this I need something probably more manual per row for Excel, semantically like:
"=SUM(The last row in A:A) + (The last row in A:A -1) + (The last row in A:A -2)...through to the last row - 30)"
I guess an easier question is how to get a specific row from a column, using the most recent entry / highest row count number and subtracting some value from it, and I can dupe that 30 times?
This one will do it
=SUM(INDEX(A:A,MATCH(99^99,A:A,1)-29):INDEX(A:A,MATCH(99^99,A:A,1)))
The Match with the impossibly high number will identify the last row and return that row's number. Subtract 29 from that to get the row number for the start of your 30 day time range and then use these two Match results in two Index formulas. Combine the Index functions with the range operator : and sum the whole thing.
You can use the "Evaluate Formula" command on the Formulas ribbon to see how the formula resolves into the desired range.
I need a formula that uses a series of numbers in one column (numbers 1-21) and returns just a number for every 21 cells.
Example: for every 21 cells return a 1 for every 21 cells return a 2 for every 21 cells return a 3. This should happen up to 650 cells
My formulas do not do this properly, I have to keep changing the # for the formula to work the way I want just looking for a faster solution. This is the formula I am using (=$B$42+2)
Put this in the first column first cell:
=MOD(ROW(A1)-1,21)+1
and this in the second column first cell:
=INT((ROW(A1)-1)/21)+1
And copy both formula down the desired number of rows
If one has the Dynamic array formula SEQUENCE() replace the ROW(A1)-1 with SEQUENCE(650,,0) and Excel will spill the values down automatically 650 rows.
I think is easier you put a filter above the column and filter, for example, the number 1, and put SUM() in the ones, that way you will know how many times go 21 times.
My question is, the column always goes 1-21 or have other numbers if you have other numbers you can put one column that repeats 1-21 in till the end and filter the same way I said before and later you can hide the column.
Hope this helps.🤞
thank you for taking the time to look at this question.
I'm looking for an equation that can easily take the numerical values from Sheet 1 (the first picture) which has 2 blank cells in between values for four values and then has 4 blank cells and then the other four values. I'm not sure if I am making sense but hopefully the picture I have attached helps.
Notice 2 blank rows between first 4 rows with values (Rows 2-11) and same between rows 16 and 25.
Also notice the 4 blank rows between the two sets of values.
For me, this is repeated for 700 values, same set up of 2 blank rows for 4 sets of values and then 4 blank rows and then four sets of values with 2 blank rows. I'm sure there is an easier way to do this.
I'm trying to recreate Sheet 2 from Sheet 1 using an equation. Is this possible?
Apologies in advance, English isn't my first language.
If the numbers are going to start in B2 and the intervals and offset staggers are static then,
=INDEX(B:B, 2+(ROW(1:1)-1)*3+INT((ROW(1:1)-1)/4)*2)
If the first number is in S6 then,
=INDEX(S:S, 6+(ROW(1:1)-1)*3+INT((ROW(1:1)-1)/4)*2)
Put this in D2:
=IFERROR(INDEX(Sheet1!B:B,AGGREGATE(15,6,ROW(Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A)))/(Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A))<>""),ROW(1:1))),"")
And copy down till you get blanks.
This will return the numbers in order that they appear on sheet 1.
The Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A)) set the data set bounds. This being an array type formula it needs to reference the smallest possible data set. This part finds the last cell in Column A and sets that as the extent of the data set so we do not do unnecessary iterations.
The MATCH part will return the last row that has text in it, if Column A has numbers then we need to change the "ZZZ" to 1E+99 to get the last row in column A with a number.
The AGGREGATE is working like a small in that it will create an array of row numbers and Errors. It will return ROW Numbers where (Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A))<>"") return true. And an Error where it returns FALSE.
The second criterion 6 in Aggregate tells it to ignore the errors, so it is only looking at the returned row numbers.
The ROW(1:1) is a counter. As the formula is dragged down it will iterate to 2 then 3 and so on. This tells the Aggregate that you want the 1st then the 2nd then the 3rd and so on.
The chosen row number is then passed to the INDEX and the correct value is returned.
If your numbers are in order (smallest to largest like your example) or you want the output in order(smallest to largest) then you can use this simple equation in D2:
=IFERROR(SMALL(Sheet1!B:B,ROW(1:1)),"")
Then copy down till you get blanks.
Here is another formula you might use.
=INDIRECT(ADDRESS((INT((ROW()-ROW($A$2))/4)*14+ROW(A$2))+(MOD(ROW()-ROW($A$2),4)*3),COLUMN($A$2),1,1,"Sheet1"))
You can paste it to the first cell where you want the result and copy down.
Note that $A$2 is the cell from where all the counting starts. If your data start from A3 you can change the references accordingly. Note further that ROW($A$2) is long for 2. I chose this syntax to enable you to identify the meaning.
COLUMN($A$2), on the other hand, just identifies Column A as the source of the data to be lifted. Row 2 in this formula is insignificant. It's the A that counts. However, COLUMN($A$2) is long for just 1, meaning column No. 1, meaning A. Once you get your bearing in the formula you can replace COLUMN($A$2) with 1.
Let's say I have Row 21 titled "Stadium". Cells in this row contain any integer between 1 and 24. I need to create another cell with some formula that will do the following:
Find all cells in Row 21 that contain the value (integer) "6". Then, it needs to average the sum of all of the cells that are a given number of cells (such as nineteen) above the cells containing 6. For example:
The Spreadsheet I'm Using
Since Row 21 (Stadium) contains the value 6 twice, I need the highlighted cell (which I chose randomly) to output the average of cells B2 and E2 (which are nineteen cells above). So whatever formula I put in should output 11.5 which is the average number of Boost items obtained for every Stadium #6 event. If I wanted to find the average number of Glide items obtained for every Stadium #3, for example, the formula would output 13 since only one Stadium #3 is recorded.
I would change the values in the formula manually depending on what stadium number I'm looking for (i.e. 6 or 3) or what item I am looking for (i.e Boost or Glide).
The reason that the formula needs to be set up this way is because data will be continually entered into this spreadsheet and that data entry will never be finished.
I figure that this might involve the OFFSET and AVERAGE functions but I have no idea what else this would involve. This is where I need your help!
Please consider the following solution:
=AVERAGE(IF(B21:G21=6,INDIRECT("B"&MATCH("Boost",A:A,0)&":G"&MATCH("Boost",A:A,0)),""))
Inputted as an array formula using CTRL + SHIFT + ENTER. Explaining the logic first in the indirect; it finds the row matching column A to the item you want to report on (ie Boost or Glide). With the row it creates a range in the indirect referencing the row you want values for. It then generates an array with only the values for the columns of the stadium (6 in this case) by comparing the array of the same dimension formed from the Stadium row to your target stadium. Lastly it takes the average of the resulting array to output the expected answer. Regards,