Building an Excel Formula - excel-formula

I am brand new to building formulas in excel (other than the easy stuff). I am trying one that is fairly simple, and I am close but can't quite get it to work!
I need to sum the values in column H, only if the value in column F is equal to the value in a specific cell. Values in column H are numerical, values in F and the specific cell are words.
So if the number in column H is listed as "Ontario" I need the sum. Numbers in Column H can be any whole, positive number.
Thanks for any help!

You want SUMIF():
=SUMIF(F:F,"Ontario",H:H)
Change "Ontario" to the cell reference.

Related

Taking column value for the if condition in excel

I'm creating target revision tool to change the old target to new target based on sales percentage. It's difficult to keep all the sale percentage in If formula as conditions. So I added the between value condition (Ex:-1.99%, -1.00%) in Column G and H.
Now the problem is If column C value (Ex: -1.00%) is in between any of the % range in Column G and H, then the target value in Column B (Ex:10) should be Increased/Decreased based on the value in Column I straight to the range in Column G and H (Ex:-1.90%, -1.00% = 10) and calculated as 20 in Column D (revised target).
I'm attaching the screen shot of the excel.
So far the formula I used is this,
=IF(AND(G5>=S5:S18,G5<=T5:T18),B5+($U$5:$U$18,U5),B5)
It looks like the values to add/subtract are following a pattern and to arrive at the value you just need to multiply the rounded percentage by -5.
But if that is not suitable, or if you want to change the amounts not to follow a pattern, you can use the table in columns G to H as a lookup table.
In cell D2 use the formula
=B2+VLOOKUP(C2,$G$2:$I$15,3,TRUE)
Make sure to format column D as General

How can i count the frequency of those of a number showing from a countif but only once?

Hi I have a bunch of data and I need to know how much of each value show up and how often the frequency is only corresponding to the unique value. I used a countif to count the unique value but I wanna know the frequency of the amount of times it shows up.
Sorry if this doesnt make any sense here's a screenshot to maybe help you understand better.
https://imgur.com/a/hLUY5um
Change the formula in B1 to,
=IF(COUNTIF(A$1:A1, A1)=1, COUNTIF(A:A, A1), TEXT(,))
and fill down to match the values in column A.
Copy column B into column E then Sort and Remove Duplicates¹.
This simplifies the formula in F1 to,
=COUNTIF(B:B, E1)
Fill down to match the values in column E.
¹ The Custom Number Format for column E is F\r\eq 0_).

The max of all possible sequential sums

Is there a way to write this using formulas.
=Max(a, a+b, a+b+c, a+b+c+d, a+b+c+d+e+...)
I don't want to use VBA for this task and I am not sure how to approach this problem.
Excel sheet expanded with formula
Excel sheet contracted without formula
Objectives:
1) For each of the peoples, (Bill, Ben, Katy), I would like to compare the maximum of the sum of only X through time.
For example, in Column J, I would like to know the current Max of the sum of X. Current is the date 1/17/19 because it is the most recent entry.
2) For each of the peoples, (Bill,Ben, Katy), I would like to compare the max of the previous entry to the max of my most recent entry.
For example, in Column K, I would like to compare the Max of the sum of X at 1/5/16 to the max of the sum of X at 1/17/16.
3) I would like Column J and K to recalculate as I bring in new data entries into Column I. As of now, using a solution mentioned below, in Column J, I think I would be using something like this formula:
=MAX(MMULT(0+(ROW(B9:I9)>=TRANSPOSE(ROW(B9:I9))),B9:I9)
This solution seems to work if I only have X's going down vertically though.
Also, as new data gets brought in, Column J and K would be pushed to the right, becoming Column K and L.
4) The highlighted region in Column I and J are my output sections that are dependent on the date of Cell B1.
For example, if I were to change the date to 1/1/2016 in Cell B1, Cell I7 would equal -4 Cell J7 would equal True.
If I were to change the date to 1/17/16 in Cell B1, Cell I7 would equal 5 and Cell J7 would equal True.
I've been playing around with this a bit, trying to use SUMIFS to pick up sum of X based on a date criteria.
I thank everyone in advance for all your help, and I apologize if my wording to this problem is unclear. I am a undergraduate student, and have no background in computer/programming/anything of that sort at all. Thank you so much!
Assuming a, b, c etc are in a column, then a standard approach will be to use an additional column with a cumulative sum of the values in the input column. Then you can just take the MAX of the column with the cumulative sum.
E.g. use of cumulative sum in column B with the input values in column A:
With MAX formula in column C:
Assuming data in A1:A5, you can use this array formula**:
=MAX(MMULT(0+(ROW(A1:A5)>=TRANSPOSE(ROW(A1:A5))),A1:A5))
which, due to its being non-volatile, is preferable to:
=MAX(SUBTOTAL(9,OFFSET(A1:A5,,,ROW(A1:A5)-MIN(ROW(A1:A5))+1)))
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

Excel formula calculation 70

I am trying to come up with a formula that possibly uses the sumproduct function combined with another function.
Let me start by explaining what I have and what I want. If I have a list of 3 product numbers or more in a column, I would like excel to find the product numbers in 2 different possible columns and if they are listed there, I would like excel to multiply and sum.
I am currently using this formula:
=SUM(SUMPRODUCT(($B$27:$B$46='Lists for Estimates'!K2)*($E$27:$E$46*$A$27:$A$46))
+SUM(SUMPRODUCT(($F$27:$F$46='Lists for Estimates'!K2)*($I$27:$I$46*$A$27:$A$46)))
+SUM(SUMPRODUCT(($B$27:$B$46='Lists for Estimates'!K3)*($E$27:$E$46*$A$27:$A$46))
+SUM(SUMPRODUCT(($F$27:$F$46='Lists for Estimates'!K3)*($I$27:$I$46*$A$27:$A$46)))))
The issue with this is I have to continue to add to the formula if I add more to "Lists for Estimates." I would like to change the formula from 'List for Estimates'!K3 and K2 to search the entire column.
Thank you in advance!
Create a new column on your data sheet that multiplies the A and E columns together (so the formula doesn't have to do it), and then use this formula:
=SUMPRODUCT(SUMIF($B$27:$B$46,'Lists for Estimates'!$K$2:$K$3,$F$27:$F$46))
Where column F contains the multiplied values. Adjust column F to suit your actual data. The multiplied value column can be hidden if preferred, or even put on a different worksheet.

Excel - function in a MEDIAN-function

I want to use the command MEDIAN in Excel but I want to make the program so that it takes the value in a column from 1 to a row that depens on a calculation in a different column and row.
For example:
=MEDIAN(G1:G(L1))
where L1 is a calculted value
The calculated value in L1 will vary and therefore this procedure will repeat itself for many couple of times. Therefore, I don't want to write the number (of G) direct into the MEDIAN-function.
Please help me! :)
If I understand it corerctly you want to write a formula that calculate the median for a specific column, but you only want to calculate it from values in the range G1:X, where X is another cell in column G, which you calculate based on some criteria. If so then this would solve it:
=MEDIAN(G1:(INDIRECT(ADDRESS(X;7))))
Where X is your formula that calculates which row, i.e. cell is the last to be included in the column G.
Try this formula.
=MEDIAN($G$1:(INDIRECT(ADDRESS($L$1,COLUMN($G$1)))))

Resources