Sum column in Excel from 1 value in a separate column until a different value in the criteria - excel

I am trying to sum a column A based on a value in column B, but I only want to sum the values until I reach a different criteria value (in column B). When I reach that value, I want to reset the function & repeat.
A
B
Sum Value I'm looking for
12
N/A
12
34
N/A
46
21
N/A
67
45
BREAK
109
232
N/A
232
64
N/A
296
231
BREAK
527
423
BREAK
423
46
N/A
46
4
N/A
50
56
N/A
106
86
N/A
192
235
N/A
427
463
BREAK
890
3
N/A
3
57
N/A
60
75
BREAK
135
I have tried SUMIF but cannot get this to work. Any help would be greatly appreciated.
Thank you!

The following formula should work:
=SUM(A$2:A2)-SUMIF(B$1:B1,"BREAK",C$1:C1)
And populate down

I've started using this formula (in cell C2):
=IF(B2="BREAK";A3;C2+A3)
This is not entirely correct, but it gives another idea: in order to repeat the calculation of the whole sum, you do this in an cumulative manner (first you get A2+A3 (which you put in cell C2), then A2+A3+A4 (which you put in cell C3), ...).

Related

Find out minimum value of specific columns in a row in MS Excel

My table in Excel looks something like this:
abcd 67 94 52 89 24
efgh 23 45 93 54 34
ijkl 64 83 23 45 92
mnop 34 45 10 66 53
This is a student database containing marks obtained in various subjects. I need to calculate the percentage in each row such that out of 5 subjects, the first subject is always included with other 3 subject with maximum marks.
Example: abcd 67 94 52 89 24 75.5%
Here 75.5%=(67+94+52+89)/4=302/4=75.5 where 24 being the lowest has been excluded and 67 has to be taken even if it were the least.
What I require is the least(excluding the first column, of course) of all the columns in that particular row, so that I can sum all the marks and subtract this least marks and finally use it to calculate the percentage.
Any help/suggestion would be appreciated. Thank You.
You'll need to adjust this for your columns, but if you sum the entire range, then subtract the min value after, do a count of the range then subtract one from that, you will be able to get the average.
This code is using the 4 values from column B through F and the 4 values are: 67 94 52 89 24... which results in 75.5
=(SUM(B3:F3)-MIN(C3:F3))/(COUNT(B3:F3)-1)

How to paste list of values into cells of same columns based on equal intervals in excel?

Like i have list of some numbers and i wanted to paste those values in cells such as A1 which get first value then A9 get second value similary.
I want solution of this without using macros.
A B C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
The value which I have are:-
87
75
67
74
94
99
98
80
64
65
59
77
97
99
so I wanted that value 87 goes to A1 then 75 goes to A9 then 67 goes to A18 and so on..
Start in B1: =A1 just for the first (your list is in A1:A14 for example)
In B2 write the following:
=IF(MOD(ROW(),9)=0,INDEX($A$1:$A$14,INT(ROW()/9)+1,1),"")
Mod(Row(),9)=0 to test if the row is the 9th after the precedent Value
Int(Row()/9) to get from the list in A the next row
IF to return empty
You can drag it down
When finish copy column B paste special Values in a new column and you can work with it normally

How to copy field in PivotTable

I want to copy a field in the PivotTable summary area. Below is my PivotTable:
Group_Age Sum of attrition_flag Count of acct_id Max of age
1 73 661 27
2 65 663 37
3 54 779 57
4 32 467 59
5 40 725 62
Now if I also want to add Min of age, how do I do that?
Currently I am trying to copy and paste field "Max of age" in the summary area and change the field settings, but I am unable to copy and paste.
Just drag the Age field into Σ VALUES a second time and for this "Summarize value field by" Min.

How to format a number to appear as percentage in Excel

So lets say I have a few numbers in a sheet
a b c d
1 33 53 23 11
2 42 4 83 64
3 75 3 48 38
4 44 0 22 45
5 2 34 76 6
6
7 Total 85
I would like to display those numbers so that the cell value still holds the original figure (A1 = 33)
but the cell displays both the number and a percentage from the total (B7) eg
a b c d
1 33 (39%) 53 (62%) 23 (27%) 11 (13%)
2 42 (49%) 4 (5%) 83 (98%) 64 (75%)
3 75 (88%) 3 (4%) 48 (56%) 38 (45%)
4 44 (52%) 0 (0%) 22 (26%) 45 (53%)
5 2 (2%) 34 (40%) 76 (89%) 6 (7%)
6
7 Total 85
I know how to format a cell as a percentage, but I can't figure out how to display both original values, the calculated percentage value (value/total*100), but not change the cell value so I could still sum the cells in the end (eg. A6 =SUM(A1:A5) = 196)
Does anyone have an idea? I was hoping there could be a way to duplicate and calculate the figure using text formatting, but I can't get anything to work.
I'm guessing this is a trivial answer and maybe not what you're looking for, but why not just add a column for each of the columns you have now?
a a' b b' c c' d d'
1 33 (39%) 53 (62%) 23 (27%) 11 (13%)
2 42 (49%) 4 (5%) 83 (98%) 64 (75%)
3 75 (88%) 3 (4%) 48 (56%) 38 (45%)
4 44 (52%) 0 (0%) 22 (26%) 45 (53%)
5 2 (2%) 34 (40%) 76 (89%) 6 (7%)
6
7 Total 85
#Ari’s answer seems to meet to meet the requirements in your question, not repeat information more than the example you gave for output requirement and be viable for up to around 8000 or so columns to start with (unless a very old version of Excel) and Jerry’s comment is also correct that what you want to achieve the way you want to achieve it is not possible.
However there are other approaches that might be acceptable substitutes. One is to copy your data and Paste Special with Operation Divide, either elsewhere or over the top of your data. If over the top this either shows the values or the percentages otherwise duplicates your data. Over the top would also require something like Operation Multiply to revert back to values, and reformatting each time if to appear as in your example.
Another is to use a PivotTable with some calculated fields and both are shown below:
I appreciate neither is exactly what you are asking for.

Excel table formulas to return blank

I have a table in excel with 2 columns, the E column is the running total the D column is the input value so normally it would be = E15+D16 however, i want the E column to return a blank if nothing is entered in the D column- what formula do I need?
1 Nov-23 Nov-30 1,230 1,230
2 Dec-01 Dec-07 130 1,360
3 Dec-08 Dec-14 416 1,776
4 Dec-15 Dec-21 124 1,900
5 Dec-22 Dec-28 102 2,002
6 Dec-29 Jan-04 83 2,085
7 Jan-05 Jan-11 95 2,180
8 Jan-12 Jan-18 88 2,268
9 Jan-19 Jan-25 102 2,370
10 Jan-26 Feb-01 130 2,500
11 Feb-02 Feb-08 311 2,811
12 Feb-09 Feb-15
13
14
15
16
17
18
19
20
21
22
=if(D16="","",E15+D16)
You dont even need the ISBLANK, just use empty quotes.
ISBLANK is what you're looking for.
In E16 =IF(ISBLANK(D16), "", E15+D16)
Use If and IsBlank in conjunction.
Do a check to see if the cell is blank, then depending on the result do the sum or the return blank. I don't have excel in front of me atm, but it should go something like this:
=if(ISBLANK(D16), "", E15+D16)
You can drag this down starting from the second cell in the column where this running total lives. The first one is obviously just the value from the adjacent cell.

Resources