i have data in Column A - Days and Column B - Sales i want calculate running total based on Days Value like
Column A Column B
Day1 150
Day2 200
Day3 175
Day4 250
i want total running sum in Column E Based on Value in Column D
here i applied this formula to running sum based on cell value
=SUM($B$2:B2,INDEX($B$2:B5,MATCH($D$2,$A$2:A5,0)))
here i have getting wrong result like if i enter (Day3 in Cell D2 getting result in Cell E2 - 325) it's wrong
The syntax is just a bit off, you should add up the range from B2 to the position found by the match, in this case B4:
=SUM($B$2:INDEX($B$2:$B$5,MATCH($D$2,$A$2:$A$5,0)))
This works because Index returns a reference and can be used as one end of a range.
Related
I have the following Excel spreadsheet:
A B C D E
1 Sales 500 200 400 300
2 Difference (Helper Row) -60% 100% -25%
3
4 Criteria: -20%
5 Result: 2
Formulas:
C2 = C1/B1-1
D2 = D1/C1-1
E2 = E1/D1-1
B5 = COUNTIF(B2:E2,"<"&-0.2)
In Row 1 you can see the sales over the last 4 periods. In Row 2 the difference between the sales is calculated using the simple formulas described above.
In Cell B5 I want to show the number of differences (Row 2) which are below the criteria in Cell B4. In this case the result is 2 because -60% and -25% are below the criteria of -20%.
All this works perfectly so far. However, I would prefer to have this system without the Helper Row 2 that I currently use to calculate the differences between the sales in Row 1.
Do you know a formula that gives me the exact same result but calculates the differences automatically and then counts them if they meet a certain criteria?
Try the following
=SUMPRODUCT(--(C1:E1/B1:D1-1 <B4))
If dealing with potential 0s in Sales
={SUM(--(IFERROR(C1:E1/B1:D1-1,0)<B4)*--(C1:E1>0))}
I have a table like this:
Length 4
year 1 2 3 4 5
A 100 400 300 200 400
B
And in column B I want a sum of A from the past [length] years. For this I figured I needed an OFFSET, so my function is (for year 2):
=SUM.IF(OFFSET(B3;0;0;1;-B1);">0")
The if statement is used so it doesn't give an error when it reaches the edge of the table, but for years 2 and 3 the OFFSET range is outside of the worksheet so it doesn't work. How can I specify a condition that it just doesn't sum anything that isn't on the worksheet?
In A2:
=SUM(INDEX(1:1,COLUMNS($A:A)):INDEX(1:1,MAX(1,COLUMNS($A:A)-3)))
Copy to the right as required.
Regards
Ok, it was hard to decypher the question:
When you ask column B, I guess you mean row 4, right?
You don't need SUMIF, because SUM doesn't count empty cells or cells
with non-numeric value.
The reference to the length value should be absolute, so it doesn't
change as you copy the formula:
$B$1
OFFSET's Width value cannot be negative, rather have the Cols value =
-[Length]:
OFFSET(C3;0; -$B$1...
(Now you are referencing 4 columns left to C3)
Make sure it is not out of the worksheet by not letting more than the [column number of the given cell minus 1] be referenced left from the cell:
OFFSET(C3;0; -MIN(COLUMN(C3)-1;$B$1)...
That is the starting point of your range to sum; you should sum it
up to recent year's value. So the correct formula in C4 is:
=SUM(OFFSET(C3;0;-MIN(COLUMN(C3)-1;$B$1)):C3)
A B
1 5
2 10
2 15
3 20
I want to calculate percentile for a column of values B if A is equal say 2. That's I want to get range of B2,B3 and calculate percentile of this.
So basically the question is: how do I select range in one column with the checking with another column?
I.e. it works perfectly with SumIf and CountIf, I just need the same with PercentileIf. Thx!
This will give you the 25th percentile of A1:A6 for all cells where the value in B1:B6 equals 2:
=PERCENTILE.INC(IF(B1:B6=2,A1:A6,""),0.25)
It's an array formula and must be entered with Ctrl-Shift-Enter.
In Cells A1:A4 I have Dates. In Cells B1:B4 I have numbers. In C1 I have todays date. I want in Column D1 the sum of all the values in B which have a corresponding date in column A that is less than or equal to the date in C1. For example:
A B C D
1 6.6.13 300 8.6.13 512
2 7.6.13 200
3 8.6.13 12
4 9.6.13 5
D1 Should be calculated by a formula. How can I achieve this with a formula. I have tried
=SUMIF(A1:A4;<=C1;B1:B4)
but it seems to not be correct.
The if condition has to be in quotes; try the following:
=SUMIF(A1:A4;"<="&C1;B1:B4)
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