Excel multi-column averages - excel

I need to take the value in two data columns A and C, get a percentage by dividing the current value of columns A and C by the top value (which is a total), and then average the two percentages and spit them out in column D. For example D2 should be (100(226/508)+(100(218/490))) / 2). I'd prefer to do this with one equation - is it possible?
A B C D
1 508 490
2 226 44.49% 218
3 229 45.08% 221

The formula you want is
=(100*A2/A$1 + 100 *C2/C$1)/2
and the select all of column D downwards and then edit->fill down
The relative reference A2 will change in each row to the new row but A$1 is an absolute reference and will stay as the value in row 1.
You can also do this with array formula that do the fill down for you. See MS article

Related

I want range for specific value in excel as

I want range for specific value in excel as,
my values in column A
122.7
250.6
377.9
507.1
635.3
761.1
892.7
1021.5
1154.7
1284.7
my values in column B
50
100
150
200
250
300
350
400
450
500
I have to compare value is 533 in A column. If 533 is value then it should return range 507.1 and 635.3 in separate row for further calculations. (e.g Similarly I input value is 210 then it should return range 122.7 and 250.6 in separate row.)
for further calculations,value which we got from above 507.1 and 635.3 should take value from Corresponding column B i.e value of 200 and 250 in separate row (e.g value which we got 122.7 and 250.6 should take value from Corresponding column B i.e value of 50 and 100 )
Considering your Lookup value is in D1,
Put this formula in E1 to get upper range
=INDEX(B:B,MATCH(D1,A:A,1)+1)
and this formula in F1 to get the lower range
=INDEX(B:B,MATCH(D1,A:A,1))
This should work for you
c1 = Enter the search value
Formula in C2
=INDEX($A$2:$B$11,MATCH(INDEX($A$2:$A$11,MATCH(C1,$A$2:$A$11,1)),$A$2:$A$11,0),2)
Formula in D2
INDEX($A$2:$B$11,MATCH(INDEX($A$2:$A$11,MATCH(C1,$A$2:$A$11,1)+1),$A$2:$A$11,0),2)

Calculate standard deviation of same text values between cells in same column

The last few days I have been trying to create a macro in Excel which can calculate standard deviation which will take values from column B of same text values between different cells in column A and give the result in corresponding cell in column C. In my sheet there are lots of different text values in column A and corresponding value in column B. I want to take all values of column B from first row to last row of corresponding same text in column A and calculate the standard deviation of these values and shows the result in column C.
As an example, when it starts from first cell (aass) then it has to count all aass and take values from corresponding cell of column B after that calculate standard deviation. Please help me out.I will be happy to hear from you guys. I am trying to show how my sheet which will look like as below:
column A column B column C
text value result(standard deviation)
aass 112 35.16
aadd 243 12.9
ffdd 523 108.55
aass 198 35.16
aadd 252 12.9
aass 136 35.16
ffdd 342 108.55
ffdd 312 108.55
aadd 222 12.9
aadd 255 12.9
ffdd 322 108.55
aass 112 35.16
jjhgf 487 25.8
pouwe 565 6
jjhgf 451 25.8
jjhgf 424 25.8
qwert 643 0
pouwe 553 5
qwert 643 0
..... .... ...
..... .... ...
This is what I used without VBA. This is an array formula (entered using Ctrl+Shift+Enter) which resides in cell C1:
=STDEV(IF($A$1:$A$9=A1,$B$1:$B$9))
(In in my example file I have only 9 rows of data.)
In newer versions of Excel you can use this:
=STDEV.S(IF($A$1:$A$9=A1,$B$1:$B$9))
For the entire population use this:
=STDEVP(IF($A$1:$A$9=A1,$B$1:$B$9))
or
=STDEV.P(IF($A$1:$A$9=A1,$B$1:$B$9))
The following versions will be MUCH SLOWER:
=STDEV(IF(A:A=A1,B:B)) , =STDEV.S(IF(A:A=A1,B:B)) ,
=STDEVP(IF(A:A=A1,B:B)) , =STDEV.P(IF(A:A=A1,B:B)).
I will show you what I mean by a Table with structured references.
I copied your data for the text and value columns. I also added the header: Result to cell C1.
I then selected the Table option from the Insert ribbon (on the Tables tab)
I then entered this formula in C2 as an array formula, confirming it by holding down ctrl+shift while hitting Enter
=STDEVP(IF(Table1[[#This Row],[text]]=[text],[value],""))
Excel automagically copied that formula down to the last row and produced the requested results. If you now add a row, the table will extend (including the formula). You can also add columns with different formulas.
In the formula above, Table1[[#This Row],[text]] refers to the context of the text column only on the row containing the formula, and [text] by itself refers to the entire text column; [value] refers to the entire value column.
The autoextension, and the ability to use the actual column labels is a desireable feature of Excel tables and structured references. It is similar to having dynamic named ranges, but easier to implement.

Sum the values of if statements on multiple rows? (Excel)

Say I have a spreadsheet which looks like this:
A B C
1 In Actual Predicted
2 Thing One 300
3 Thing Two 564
4 Thing Three 256 1065
I want to be able to get a sum of the "predicted" column which incorporates values from the "actual" column if the "predicted" value is empty.
I.e. in this case, the value would be 300 + 564 + 1065 = 1929.
I know that I can achieve this for any individual row like so:
IF(C2="",B2,C2)
How do I get a sum of these "if" statements for each individual row?
Thanks.
That can be done with Sumifs() and no helper columns
=SUMIFS(B:B,C:C,"")+SUM(C:C)
Cell D2 = IF(C2="",B2,C2)
Cell D3 = IF(C3="",B3,C3)
...drag / copy to all relevant D cells...
Cell E1 = Sum(D:D)

Sum the values in Excel cells depending on changing criteria

In an Excel spread sheet I have three columns of data, the first column A is a unique identifier. Column B is a number and column C is either a tick or a space:
A B C
1 d-45 150 √
2 d-46 200
3 d-45 80
4 d-46 20 √
5 d-45 70 √
Now, I wish to sum the values in column B depending on a tick being present and also relative to the unique ID in column A. In this case rows 1 and 5. Identifying the tick I use
=IF(ISTEXT(C1),CONCATENATE(A1))
&
=IF(ISTEXT(C1),CONCATENATE(B1)).
This leaves me with two arrays of data:
D E
1 d-45 150
4 d-46 20
5 d-45 70
I now want to sum the values in column E depending on the ID in column D, in this case row 1 and 5. I can use a straight forward SUMIFS statement to specify d-45 as the criteria however this unique ID will always change. Is there a variation of SUMIFS I can use?
I also wish to put each new variation of ID number into a separate header with the summed totals underneath, that is:
A B
1 d-45 d-46
2 220 20
etc...
You can try this:
To get the distinct ID's write (in H1 then copy right):
This one is an array formula so you need Ctrl Shift Enter to enter the formula
=INDEX($A$1:$A$5;SMALL(IF(ROW($A$1:$A$5)-ROW($A$1)+1=MATCH($A$1:$A$5;$A$1:$A$5;0);ROW($A$1:$A$5)-ROW($A$1)+1;"");COLUMNS($A$1:A1)))
Now to get the sum (H2 and copy right)
=SUMPRODUCT(($A$1:$A$5=H1)*ISTEXT($C$1:$C$5)*$B$1:$B$5)
Data in the example is in A1:C5
Depending on your regional settings you may need to replace ";" field separator by ","
Try this,
SUMIFS
=SUMIFS(B1:B5,A1:A5,"=d-45",C1:C5,"<>")
where "<>" means that the cell is not empty...

Issues with VLOOKUP in Excel

I have a tax table in one sheet that has a list of tax values. For example:
Sheet1: Tax Tables
A B C
1 Min Max Taxed
-------------------
2 50 100 10
3 100 200 20
4 200 300 30
In another sheet I have a gross income value of say 120 in cell A1. What I want to do is have a vlookup (I'm assuming that's what I should use) that checks cell A1 to see if it's between the Min and Max and then outputs the taxed amount in B1.
Sheet2: Income
A B
1 Gross FedTax
-----------
2 120 Value from Column C goes here
I already have the sheet in Tax Tables set up with named spaces A:C=Min and B:C=Max
I tried doing this:
=AND(VLOOKUP(<A1,Min,3,False),VLOOKUP(>A1,Max,2,FALSE))
But not even close...
I just want to check column A in the first sheet to see if it's less than the the value in the second sheet, and check column B in the first sheet against the value in the second for if its more, then put the value in column C in the first sheet into the cell next to the value in the second sheet.
To use a VLOOKUP, put your maximums and minimums in the same column.
Then use the TRUE argument, which means it looks for the next value that matches. Assuming the value you're looking up in D2, you'd put a formula like this in E2:
=VLOOKUP(D2,$A$2:$B$5,2,TRUE)
First of all it is unclear what you would apply when the amount is exactly 50/100/200/300/... So i decided to include the lower limit in the interval and exclude the upper limit.
For this problem I would use a sumifs like this (you have to decide on which side to put the equal sign:
=SUMIFS(Sheet1!C:C;Sheet1!A:A;"<="&A1;Sheet1!B:B;">"&A1)
This would only take those elements in column C that have a value in column A smaller than or equal to 120 and a value in column B greater than 120

Resources