Partial Sums from a Given Column - excel

I was wondering if there is a quick way to have Excel sum up chunks of a selected column based on where blanks appear in that column. For example, the column might look like:
10
12
15
11
2
3
10
13
14
14
13
1
9
8
6
and ideally each partial total would be placed where the first element being summed was previously. Can this be done without VBA?

Leave B1 empty, In B2 enter:
=IF(A2<>"","",SUM($A$1:A2)-SUM($B$1:B1))
and copy down............should look like:

Related

How to create two columns that match all values from a third in excel or OpenOffice?

I have one column with 10 cells, every cell have a different value in it. How can I create two columns that have every cell matching with the other 9.
Example :
1
2
3
4
5
6
7
8
9
10
Become
1 2
1 3
1 4
1 5
......
2 1
2 3
2 4
2 5
.....
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
I am not sure I read the same question as others did. I think your example was merely that, an example, and that these first 10 cells could contain anything and you wanted every permutation that could result. While I think that the other answers might work for the specific situation you describe, they may not work if you had other data in those cells. Hence I am offering a variation which uses a similar technique to reference the cells indirectly. The permutations of 2 objects from a set of 10 unique objects would result in 90 objects (which is why the above technique from Tom Sharpe references 90).
Assuming that you have your 10 items in A1 through A10, I would put the following formula in B1 and copy it down through B90:
=INDIRECT("R"&QUOTIENT(ROW()-1,9)+1&"C1",FALSE)
Also, I would use this formula in C1 and copy it down through C90:
=INDIRECT("R"&MOD(ROW()-1,9)+1+((MOD(ROW()-1,9)+1)>=QUOTIENT(ROW()-1,9)+1)&"C1",FALSE)
The result should give you something like what is shown in the attached matching your example.
Likewise, it would show the permutations of any values you had in A1 through A10 as shown in the second attached picture with words instead of the numbers 1 through 10.
In Excel (without VBA or such like), one way:
In A1 and copied down to A100: =INT((ROW()+9)/10).
In B1 and copied down with Ctr to B10: 1.
Select B1:B10 and copy down with Ctrl to B100.
In C1 and copied down to C100: =A1=B1.
Select ColumnsA:B, Copy, Paste Special, Values.
Filter A:C ,select TRUE in ColumnC and delete all blue indexed (visible content) rows.
Delete ColumnC.
Or in A1:
=QUOTIENT(ROW()-1,9)+1
copied down to A90 just to be different.
Then in B1:
=MOD(ROW()-1,9)+1+((MOD(ROW()-1,9)+1)>=A1)
copied down to B90.

Sum across columns based on 3 criteria

I'm trying to get a Sumif working across multiple rows.
For example, say my data source is below:
A B C
1 1 10 11
2 2 9 12
3 3 8 13
4 4 7 14
5 5 6 58
I want to sum from Columns A to C, in row 3. Output would be 24.
Ideally my criteria for the Horizontal Start, Horizontal End and Vertical would all be referenced in different cells which can be updated to get a new result depending on the criteria.
Is this possible so that the criteria cells can be updated and the formula will update accordingly?
Use a SUMIF, and betweem the logical criteria, simply use 3 criterias by seperating each with "&"'. This says that excel will sum if a happens, and b and c.

Excel formula using countif

There are 11 numbers in a column.
5
5
5
5
12
13
5
9
2
5
10
I need to build a formula that tells me how many times occurs the following situation: Number is bigger than each of previous four numbers.
In this case the situation occurs 3 times. By:
12 bigger than 5;5;5;5
13 bigger than 12;5;5;5
10 bigger than 5;2;9;5
Assuming your data starts in A1 you can use if() and max() to do this. Add this to B5 (next to the 12 in your example):
=IF(MAX(A1:A4)<A5, 1, "")
This will put a 1 next to 12. You can copy this formula down to find the other values where this is true.
This works by looking at the MAX() value of the previous 4 values. IF() they are higher than the current value, then it prints a 1.

Excel - Remove duplicates and SUM at the same time

I have a column with ID's, but they are duplicated; for instance:
"0,0,1,1,1,2,3,3,4,4, ... "
For each row, I have a given value in the other columns, for instance:
"0-24; 0-36; 1-13; 1-34; 1-23;..."
I want to keep only one row with each ID but I need to sum the values of each ID, that is, sum all the values in all columns for a given ID (0,1,2,...), which may include several rows.
Is there a easy way to do this using Excel?
Here is some sample data (table to the left) together with the desired output (tables to the right).
ID Value ID Value
0 24 0 60
0 36 1 70
1 13 2 16
1 34 3 24
1 23 4 48
2 16
3 9
3 15
4 24
4 24
What you can do is to copy your IDs and paste them for example in another Sheet. Let's assume your original table is in Sheet1, and you copy all your IDs to column A in Sheet2.
Then you remove duplicate IDs in Sheet2:
Select column A > Data Ribbon > Data Tools > Remove Duplicates
In column B, you then put the formula:
=SUMIF(Sheet1!$A:$A, Sheet2!$A2, Sheet1!$B:$B)
Note: above formula goes into cell B2 on Sheet2, and you copy it down with pasteSpecial > only formulas.
Edit: if you still want the same number of rows etc because of the information in your other columns, just skip the "Remove duplicates"-part.

Compare two columns in same sheet and find difference

Hi I have an excel sheet with two columns- A and B. Each column has similar data and B has more data than A. How can I spot data which are available in B but not present in A?
A 12 13 14 15 and
B 12 123 13 14 145 15 16
Use CountIf() or Vlookup(). Put in cell C2 this formula =countif(A:A,B2) and copy it down. You'll see 0 when they are unique.

Resources