Stop counting when empty row is found - excel

I have a table in which in one cell I display the sum of other cells =SUM(I57: I67). When I copy
the row containing this formula, it is not adapted, is calculated the whole amount for
the next 10 rows.
How to adjust the formula to calculate the sum of the values from cells until empty cell?
So in cell N46 the formula is =SUM (I46:I56)
As I copied the rows 46, 47 and 48 the formula of cell N57 is =SUM (I57:I67)

You can use following array formula:
{=SUM(A1:INDEX(A1:$A$10000,MATCH(TRUE,ISBLANK(A1:$A$10000),0)))}
For an array end address (i.e $A$10000) you can use any address larger than the last cell used.
Array formula after editing is confirmed by pressing ctrl + shift + enter

Related

SUM if header row dones't contain a substring AND range doesn't contain #N/A

In Column A I want to sum all the cells in range B2:J2 that their header row doesn't contain the word "Price", also one of the cells in range B2:J2 might be #N/A.
In the example I shared only the cells that are highlighted in grey are relevant, and the formula should return 5.
I would love to get your help.
You can use array formula with SUM:
=SUM(IFERROR(NOT(ISNUMBER(SEARCH("price",$B$1:$J$1)))*(B2:J2),0))
Array formula after editing is confirmed by pressing ctrl + shift + enter

Formula to fill column cells with incrementing values (LibreOffice)

LibreOffice 5.1.6.2 Calc, column have 62 cells(1-62). The first cell starts with decimal value 2147500032. I need fill the rest cells with decimal values by increasing each subsequent value by 65536.
example:
2147500032
2147565568
2147631104
2147696640
....
How to do this with formula?
Edit: my answer: formula is =H1+65536, then just to fill the formula into adjacent cells.
Put 65536 in cell A1, then H1 is 2147500032.
In cell H2 put :
=H1 + $A$1
And drag down.

Excel 2016: adding number values in a row from cells with text and numbers

I need to add number values in a row where cells contain text and numbers; like "P1" or "S7" where I need to add the 1 and 7 into a total column.
I can extract the number values from individual cells using =RIGHT(V3,SEARCH("P",V3))+0, but can't figure out how to do that easily for row of 32 cells.
Example:
For example to sum D1 through G1, use:
=SUMPRODUCT(--MID(D1:G1,2,9999))
As you see, this formula discards the lead text character in each cell.
EDIT#1:
To add cells beginning with P or S only, use:
=SUMPRODUCT(--MID(D1:G1,2,9999)*(LEFT(D1:G1,1)="P")) + SUMPRODUCT(--MID(D1:G1,2,9999)*(LEFT(D1:G1,1)="S"))
You can place your formula on the first column of your row. Then when you copy the formula across your columns it will automatically reference the cell offset the same as V3 is offset from each other cell with formula.

Excel Max Length of each column data

Simple one for someone hopefully. I'm trying to get the max length of each column in an excel sheet but it doesn't seem to be working now. I was using =MAX(LEN(A2:A200)) for example and because MAX is not an "official" formula but is still there you seem to have to press CTRL + ALT + SHIFT once you have finished typing it.
When I do this it puts curly brackets round the whole formula like this {=MAX(LEN(A2:A200))} but if I click into the cell they disappear. the length of the first column will appear but then if I autofill to the next column it shows same length of column data from the first column rather than calculating the next column.
Perhaps not a straight up programming question but scratching my head why this is not working now. I'm trying to show max length of each column above header column in new row.
Thanks
Andrew
In A1 enter the array formula:
=MAX(LEN(A2:A200))
then stop clicking.
Move to A1 with the ARROW keys. Touch Ctrl+c. Then paste to B2 through G2 using Ctrl+v:
This will put the array formula in the destination cells.
Use Gary's formula and instead of ENTER, do CTRL-SHIFT-ENTER
When I do this it puts curly brackets round the whole formula like this {=MAX(LEN(A2:A200))} but if I click into the cell they disappear. the length of the first column will appear but then if I autofill to the next column it shows same length of column data from the first column rather than calculating the next column.
It is right to use formulas with brackets (they are called Matrix formulas). The brackets disappears because when you edit the content of the cell you have to push Ctrl + Shift + Enter and not only Enter like normal formulas.
Let's assume all your data is in Sheet1 starting at cell A1.
Create Sheet2
Enter the =LEN(Sheet1!A1) formula in cell A1 on Sheet2
Pull Sheet2's A1 cell down/over to the right to cover the populated
range of Sheet1 (to copy the formula to every cell of the range in
scope) - this will give you the length of every cell in scope
Enter the =MAX(A1:A10) formula on Sheet2 in the first column below
the last line (A10 is assumed to be the last line of the first
column in this example - so the formula goes in A11)
Pull Sheet2's A11 cell over to the right till the last column to get
the MAX length of values for each column

Split data and find average Excel

I have an excel file with a 1000 rows of data. I want to split the data in a way that I have 40 arrays of 25 rows each and get the average of the data. how do I do this?
These solutions are Non-Volatile
Assuming the data is located in A1:A1000
Solution 1: Showing only the Average of the 40 sub ranges (see fig. 1)
Array Number: Enter this formula in B2, copy till B41 then copy\paste the values
=SUM(1,B1)
Averages: Enter this formula in C3 and copy till C41
=AVERAGE(INDEX($A$1:$A$1000,($B2*25)-24):INDEX($A$1:$A$1000,($B2*25)))
Solution 2: Shown the 40 sub ranges and the averages (see fig. 2):
Array Number: Enter this formula in B3, copy till B27 then copy\paste the values
=SUM(1,B1)
Enter this formula in C2, copy till AP2 then copy\paste the values
=SUM(1,B2)
Arrays: Enter this formula in C3, copy till C27 the copy till column AP
=INDEX($A$1:$A$1000,(C$2*25)-25+$B3)
Averages: Enter this formula in C1 then copy till AP1
=AVERAGE(C$2:C$27)
Assuming that:
Your data is in column A, starting from the top
You want your output in columns D and later
I would propose the following:
You leave cell C1 blank
In cell D1, you enter the formula = C1 +1
In cell C2, you enter the formula = C1 +1
Now you can drag down column C untill you get to 25 rows and row 1 untill you get to 40 columns
In the matrix you just created, cell D2 is the first data point. In this cell, you enter the formula = OFFSET( $A$1, 40 * ( D$1 - 1 ) + $C2 - 1, 0 ), which you can now drag down and across.
The offset function takes the cell that is i rows below and j rows to the right of the first argument (in this case $A$1). we don't need any column offset, so the third argument is 0. The second argument looks at the column number of your matrix to see which sub-array it's looking at ("40 * ( D$1 - 1 )") and to the row number of your matrix to see which entry within the sub-array it should take ("$C2 - 1"). The "-1" is just because we started counting at 1 instead of 0.
For the averages, you can just use the = AVERAGE() function for each sub-array.
To make it a bit clearer, you can take this image as an example. The = RANDBETWEEN() function in column A was just for testing purposes.

Resources