How can I add or subtract using case formulas? - netsuite

I have sales metrics tracking using case formulas to give me a sum when a status is updated in system notes. If you look at the image, what I'm trying to accomplish is to add a column that would show total appointments (first formula) minus the set number of '20'. I want to see the difference between the sum and the sales target of 20

Set the Summary Type to Min and sum the result using the formula. Then you can use arithmetic on the sum.
SUM(CASE ... END) - 20

Wrap your case formula in SUM(your case formula) - 20.
Change NetSuite's SUM to MINIMUM (SUM will work but probably return unexpected results on the Total row)

Related

Nested MIN within SUMIF formula

Problem: I can't seem to get the > MIN formula to work within SUMIFS
Requesting: Formula that will return the SUM of balloons IF the dollars amount is greater than the MIN
Expected output = 510,000 balloons
Note: This is just an example problem for easy comprehension. In reality the data set is much larger and I will include multiple IFs.
You can sum the entire range and then just subtract the values from the range where the dollar amount is equal to the min $.
If your min value is repeated, they will all be removed from the sum.
=SUM(C:C) - SUMIF(B:B,MIN(B:B),C:C)
I believe you were attempting to do this in one sum equation which would look like this
=SUMIF(B:B,">"&MIN(B:B),C:C)
Even easier:
=SUMPRODUCT(--(B:B>MIN(B:B)),C:C)

Cumulative Sum by Specific quantity up to value

I have a horizontal matrix of values in Excel that I want to be able to show a quantity in a series up to a predetermined total value. If the last value in the series is less than the specified quantity then the value that will satisfy the cumulative sum is the value used. Empty values thereafter.
For example: Max cumulative sum of 200 in 7 units of 30: 30,30,30,30,30,30,20.
Should be straightforward but I've had some trouble doing it. Thanks.
I've tried nested if thens with conditional sums but the formulas seems more less helpful than the basic explanation of what's needed.
I can do most of the function but the nested if thens are too complex and are creating problematic edge cases. Hoping someone has a more concise idea.
You could combine some MOD and INT together, cell A1put this formula and drag it to the right:
=IF(COLUMN()<=200/30,30,IF(COLUMN()=INT(200/30)+1,MOD(200,30),""))
Obviously you can reference these 200 and 30 from an absolute cell address.
Example to add to 308 in steps of 14:
Formula in A1:
=IF(COLUMN()<=$A3/$A4,$A4,IF(COLUMN()=INT($A3/$A4)+1,MOD($A3,$A4),""))
Another example to add to 312 in steps of 14:
You can use Min to determine the value for each cell, and Index to specify the range
Like this (also handle returning blanks for columns past the last value)
=IFERROR(1/(1/MIN($A$2-SUM(INDEX(4:4,1,1):INDEX(4:4,1,COLUMN()-1)),$A$3)),"")

Use Excel Formula to find total number of sales of specific product

I am using Excel Formulas to count the total sales of a Product. On a Data Sheet it needs to find each position of the Product and sum the number of sales.
I have used VLOOKUP to find and get one number of sales but it only takes the first sale. I tried to use COUNTIF but that didnt work.
=VLOOKUP(J1;A:E;5;FALSE)
=COUNTIF(A:A;3021;E:E;3021)
The Result i get is 6. What i expect is 6 + 10 + -4 = 12.
The Sales can also be negative -2
Screenshot to reproduce Problem:
You can use productsum which can sum the way you want.
You need to remember to enclose the arguments in own () and multiply them (dont use ,)
=SUMPRODUCT((A1:A10=J1)*(E1:E10))
The good thing with Sumproduct is that you can expand it easily to get the total sale sum (column B).
(5*6+2*10+1*-4 = 46)

How to sum under certain conditions in Excel?

I have a formula in Excel that I'm trying to work out. The formula is meant to return a sum under certain conditions.
If the salary is less than the limit amount and is greater than 30 hours worked, it is meant to sum the cells. If false then it is meant to return a calculation, but this needs to return by minus itself from a sum total to get to a final result.
The below formula only returns the reduced rate not the sum total - reduced rate = final result:
=IF($G$7*52<$K$5*(AND($C$4>30)),SUM($K$7:$K$9),($G$7*52)-$K$5)*$K$6
I can't seem to manage to think how to return sum total is their a formula I can use that could involve this part of the formula:
($G$7*52)-$K$5)*$K$6
Something like this?
=IF($G$7*52<$K$5*(AND($C$4>30)),SUM($K$7:$K$9),SUM($K$7:$K$9)-(($G$7*52)-$K$5)*$K$6)

Excel: AVERAGE IF

Lets say I have an Excel sheet such that:
Column 1 contains salaries
Column 2 contains gender (M/F)
How can I calculate the average salary for females?
=AVERAGE(IF(B1:B10="F",A1:A10))
entered as an array function (ie using Shift-CTRL-Enter rather than just Enter)
Allthough the answer is already answered/accepted I can't resist to add my 2 cents:
Sums and averages normally are displayed at the bottom of a list. You can use the SUBTOTAL() function to calculate sum and average and specify to include or exclude "hidden" values, i.e. values suppressed by a filter. So the solution could be:
create a formula =SUBTOTAL(101,A2:A6) for the average
create a formula =SUBTOTAL(109,A2:A6) for the sum
create an autofilter on the Gender column
Now, when you filter for "F", "M" or all, the correct sum and average will always be computed.
Hope that helps - Good luck
To do it without an array formula just use this:
=SUMIF(B:B,"F",A:A)/COUNTIF(B:B,"F")
Answered question, solid formulas - BUT - beware of conditional averages based on numbers:
In a very similar situation I tried:
"=AVERAGE(IF(F696:F824<0;E696:E824))" (shift control enter) - In English this asked Excel to calculate an average on all numbers in column E if a result in column F was negative (a loss) - e.g. "calculate an average for all items where a loss occured". (no circular reference)
When asked to calculate an average for all items where a gain (x>0) occured, Excel got it right. However, when the conditional average was based on a loss - Excel produced a huge error (7.53 instead of 28.27).
I then opened exactly the same document in Open Office, where Calc got the (correct) answer 28,27 from the same Array formula.
Recalculating the whole thing in steps in Excel (first new column of only losses, new for only gains, new column for only E-values where a loss/gain occured, then a "clean" (unconditional) average calculation, produced the correct values.
Thus, it should be noted that Excel and Open Office produce different answers (and Excel 2007, Swedish language version, gets them wrong) in some cases of conditional averages.
(sorry for my long cautionary tale - but be a bit careful when the condition is a number would be my advice)
You can put filter in top line of your sheet. Then Filter only Fs from Column2, then calculate average of values.
Or you can add additional column with female salaries only.
The formula would be like: =IF(B1 = "Female";A1)
Then you simply calculate average of newly created column.
Salaries gender
2500 M 0 2500*0
2400 F 1 2400×1
2300 F 1 2300×1
sum =2 sum=4700 average=4700/2
Maybe it be complex.

Resources