I'm just wanting to have a formula to count the amount of cells from E4:X4 if the number in each cell in that range is equal to the number in the cell directly above it. I was trying doing a COUNTIF with an INDIRECT ADDRESS for the cells above but didn't get anything so I was probably doing it quite wrong.
Just to be very clear for example if in that range cell E4 is 5 and above it (E3) is also 5 then to count it, and not count it if it isn't. Same for every cell down to X4.
Thanks.
You can use Sumproduct for that. In the screenshot, the formula in cell I2 is
=SUMPRODUCT(--(A1:G1=A2:G2))
To count only non-empty cells, you can change the formula to
=SUMPRODUCT(--(A1:G1=A2:G2),--(A2:G2<>""))
Related
First I used the formula:
=COUNTIF('Reach_ins'!$C$4:$C$43,B18) and this outputs the correct number of cells in range C4:C43 that equals the number in cell B18. This formula works if I change the number in B18.
This formula also works:
=COUNTIF('Reach-ins'!$C$4:$C$43,">=15")
However, this formula does not work:
=COUNTIF('Reach-ins'!$C$4:$C$43,">=$B$18") where the value in B18 is 15.
I'm trying to pick out the number of cells in range C4:C43 that are >= the vvalue in cell B18 where B18 is a value input by the user.
Any help would be appreciated.
Concatenate the cell with &:
=COUNTIF('Reach-ins'!$C$4:$C$43,">="&$B$18)
I have an Excel 2 worksheet workbook - 'Dairy' and 'Production'
Formula in 'Production' E10 is 'Dairy'!I33
I want the Formula in 'Production' E11 to be 'Dairy'!L33 (an increment of 3 columns, but same row.)
I cannot use Alt EIR, because it only increments the cell value (I33) by one column (to J33).
What formula can I use to increase the I33 by 3 columns to L33, then in the next cell/E11 increase the L33 to O33, and so on?
EXAMPLE -
Production cell number E10 E11 E12 E13
Production cell value D!I33 D!L33 D!O33 D!R33
thank you,
Mike
INDEX typically uses less calculation cycles than OFFSET and this benefit increases the more formulas you have.
=INDEX(Dairy!33:33, 1, (COLUMN(A:A)-1)*3+9)
Put that under E10 and drag right (and down if needed).
If E10 is actually the cell you want the formula and you are going to drag it down then use this in E10 and drag down.
=INDEX(Dairy!$33:$33, 1, (ROW(1:1)-1)*3+9)
You can use Offset formula which returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and the number of columns to be returned.
Syntax:
=OFFSET(reference, rows, cols, [height], [width])
Solution:
Cell E10 Formula : =OFFSET(Dairy!I$33,0,0,1,1)
Cell E11 Formula : =OFFSET(Dairy!I$33,0,3,1,1)
Cell E12 Formula : =OFFSET(Dairy!I$33,0,6,1,1)
and so on....
To make it completely dynamic, link the third argument to the current row. For e.g.
Cell E10 Formula : =OFFSET(Dairy!I$33,0,MOD(ROW(A10),10)*3,1,1)
In my excel template, I need to have a formula to multiply two numbers with 2 or 3 conditions, and then sum the found numbers in an area.
For example;
First range is; AI22:AI1100
Second range is; AB22:AB1100
Third range is; N22:N1100
Fourt range is; K22:K1100
For first formula, i need to check the second range, found the cells that contain the same value as A2, then get the row number, find the value of the first range/that row cell, then divide it to its fourth range, and go on like this till AB1100 and sum all of that found numbers.
For second formula, i need to check the second range, found the cells that contain the same value as A2, then get the row number, check the third range if its the same value as A3, if it is then find the value of the first range/that row cell, then divide it to its fourth range, and go on like this till AB1100 and sum all of that found numbers.
I tried those with sumproduct, but it only sums both ranges and divides them in the end.
I can write this in Vba, but I need to store the values in the worksheets, so it will be better if I can do this in a formula.
I am open to suggestions.
You want SUM() as an Array formula
=SUM(IFERROR((AB22:AB1100 = A2)*(AI22:AI1100)/(K22:K1100),0))
And:
=SUM(IFERROR((AB22:AB1100 = A2)*(N22:N1100 = A3)*(AI22:AI1100)/(K22:K1100),0))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when Exiting Edit mode.
Edited: So I made the question more complicated. If I would like to do a 'what if ' analysis which requires to be able to refer the last row to sum from another cell to the sumif formula. How can I do that?
Just drop the row numbers from your formula and use the entire columns:
=SUMIF(A:A,">4",B:B)
The beauty is that SUMIF will disregard non-nmeric rows anyway.
To sum up and stop at a certiain row, you can use SUMIFS with ROW:
=SUMIFS(B:B,A:A,">4",C:C,"<" & D2)
Where D2 holds the row number using the formula =ROW(<CELL>), i.e: =ROW(A2) in cell C2:
I have a range B3:Bn with dates and a range C2:Y2 with another dates range. I am trying to find a date from a range B3:Bn in a range C2:Y2 and then starting from this cell to sum values. To do this i use:
=SUM(OFFSET(C3;0;MATCH(B3;$C$2:$Y$2;0)):Y3)
But instead of Y3 I would like to say: Sum values just starting from offset cell value till + 7 other columns.
Maybe someone can help with it?
Thanks!
In the table of the figure, cell B6 contains
=SUM(INDEX(A2:P2,1,B4):INDEX(A2:P2,1,B4+B5-1))
You may use an adapted formula to carry out your task.
It indirectly sets (with INDEX) the initial and final cells for carrying out the sum. I defined it as a starting cell (column 3 of range A2:P2) and a number of cells (4).
Points to consider:
You may need to use absolute referencing for some column/row references.
You may define your range to sum in slightly different ways.
You can use the INDIRECT function. It allows you dynamically create a cell range in a formula. So you could have one cell with a forumla that create your cell range as text e.g.
=B1&":"&B2 // in Cell C1, assuming B1 is "A1" and B2 is "A2" this would result in "A1:A2"
And then you can dynamically create a cell range from that using Indirect which you can then use function SUM on.
=SUM(INDIRECT(C1)) // would result the SUM(A1:A2) in our example