In Excel, how to multiply ranges - excel

In Excel, I want to know how to multiply one range of cells (say A1:F10) by another range of cells (static range say H1:M10) then put the answer in one cell only (say Cell P1) .... then move down one row and multiply the new range (say A2:F11) by the same static range (say H1:M10) then put the answer in the cell below the first answer (say P2) and so on....
When multiplying I need A1 to multiply by H1, B1 multiplied by I1, A2 multiplied by H2 and so on...
I have no clue, please thank you for your help... For info my range is a range of 2800 cells by 2800 cells so fairly large. Is there a way of doing this in Excel or do I need to use VB? thank you so much...

You can use Sumproduct for that. Use a relative reference for the first range and an absolute reference for the second range.
Consider the following screenshot:
The formula in cell P1 is
=SUMPRODUCT(A1:F10*$H$1:$M$10)
Copy down. In cell P2 it will change to
=SUMPRODUCT(A2:F11*$H$1:$M$10)
and so on, incrementing the rows of the first range in each row. The second range is fixed to H1 to M1 with the $ signs and will not change when copied down.

Related

Excel Define a range based on a cell value (column wise - A to E )

So, for example: My selection is A1:E1 That are five cells. is it possible to let excel determine this by setting a cell value (like A2) to 5.
It for the purpose of easily changes a lot of ranges with one change in a cell value. So if I would change the cell value (A2) to 6. The range would automatically change to A1:F6
Could somebody help me???
Try this formula
="=A1:"&ADDRESS(A2,A2,4)
Adding to my comment you can use INDEX to return the range you're after.
This will use B1 to determine the last cell in the range.
=$A$1:INDEX($1:$1,,$B$1)
This will then sum the values in that range:
=SUM($A$1:INDEX($1:$1,,$B$1))

How to input min/max values and have Excel generate cells for each number in the range

I have 2 cells A2 and A3, I will input a min value and max value respectively in each cell. Say 100 in A2 and 200 in A3.
I would like Excel to populate cells with values within that range. So Column B would have cells 1-101 filled in with 100,101,103,104,105....200.
Is there any easy way to do this or should I just stick to putting 100 in B1 and dragging it down?
In you first cell:
=IF(ROW(1:1)-1+$A$2<=$A$3,ROW(1:1)-1+$A$2,"")
Then drag/copy the cells down far enough to cover any combination you will have. You can fill the whole column if you want.
Microsoft is working on their Dynamic Arrays, Once released, a simple formula in the first cell of:
=SEQUENCE(A3-A2+1,,A2)
Will autmatically fill down the sequence without the need of dragging the formula down.

Average cells within a range updates automatically, based on row values

I have attached a sample file below. Can you help?
I'm looking for a formula to show the calculated average in cell B1 of the included sample, were the range (currently B2:B3) updates automatically when a new row is inserted at row 4 and the value 1.3 is shown in cell A4.
The range of the average formula in Cell B1, should update to show B2:B4... etc and continue to automatically update as new rows are added and additional numbers are added (1.4 in cell A5, average range updates to B2:B5, 1.5 in A6, average range updates to B2:B6 and so on...)
Thanks in advance for your help
Sample
Okay, finally I got what you mean. But your sheet looks not very efficient. Why not set A1 to 1, and A2 to =A1+0.1, and so on? For now A column has very long formulae which is hard to read.
Anyway... to use averageif() on 1.1, 2.1, etc, it'll be easier to make A column to text. So add another column(say C) and set C1 to =text(a1, "#") and drag down. Now that C1 is text, you can use averageif() with wildcard(*). set B1 like this:
=AVERAGEIF(C2:C99, C1&"*", B2:B99)
Of course, you should copy B1 and paste onto B4 and so on manually. Sample Excel file is here.

How to do a sum with variable (dynamic) range?

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

Copy subtotal with fixed range to other table cells

In Excel, I have the following formula:
=SUBTOTAL(9;INDIRECT("D$"&$B$2&":D$"&$B$3))
It counts the values of a range, which size is defined in other fixed table cells.
B2 = starting point = 9
B3 = end point = 17
So in short:
=SUBTOTAL(9;D9:D17)
I now want to copy that formula to other cols in the same row, I want to pull it to the right (I don't know how that feature is called in Excel). How can I achieve, that only D changes to E and then to F and so on, by the base of my formula? The size of the range should remain the same and has to be linked to table cells B2 and B3.
It's normally better to use INDEX rather than INDIRECT in these type of formulas. One advantage is that the formula can be dragged across....try this version
=SUBTOTAL(9;INDEX(D:D;$B$2):INDEX(D:D;$B$3))

Resources