Average using a difference from MAX in Excel - excel

I am trying to average a column of numbers, throwing out values a specific difference from MAX. The users will not be Excel experts, so I am trying to stay away from Array formulas so they can edit the difference number based on different conditions.
=AVERAGEIF(DM7:DM34,"=>Max(DM7:DM34)-3",DM7:DM34)
This returns a #Div/0, while the MAX portion alone returns the value I need.

I think what you may require is something like:
=AVERAGEIF(DM7:DM34,">="&MAX(DM7:DM34)-3)
You might achieve some added "comfort" by changing 3 in -3 to a cell reference where the difference number would be placed/changed.

Related

Excel - Using nested IF COUNTIF to find count of 3 values within range, and if they are less than or greater than a static number

In column K, I have some data categorized by 3 different values : Rent, Stacked, Available
What I am attempting to do is put together a formula that will get me a count of each of these, and then figuring out if they are less than, or greater than a number that we will set as the "threshold". I think there's something with the nested IF statements that aren't allowing it to work.
Reading it out the formula should go like this - if the count of "rent" is greater than 30, than it is outside of threshold, otherwise if the count of "stacked" is greater than 30, than it is outside of threshold, otherwise if the count of "available" is greater than 40, than it is outside of threshold, but if none of these are outside of the threshold, than they are within threshold.
Currently what i have is this:
=IF(COUNTIF($K:$K,"Rent")>30,"Outside Thresh",IF(COUNTIF($K:$K,"Stacked")>30,"Outside Thresh",IF(COUNTIF($K:$K,"Availble")>40,"Outside Thresh","Within Thresh")))
This seems simple enough, but I don't know if I've overthought it so much that now I can't figure it out.
Any assistance will be appreciated.
It works when I copy paste the formula into a cell? See if you didn`t make a type with "Availble"
=IF(COUNTIF($K:$K,"Rent")>30,"Rent Outside Thresh","Rent within Thesh")&IF(COUNTIF($K:$K,"Stacked")>30," Stacked Outside Thresh"," Stacked within Thresh")&IF(COUNTIF($K:$K,"Availble")>40," Available Outside Thresh"," Available Within Thresh")
Why not put the code in 3 different cells?

How to create four equal buckets of decimal values

I have an excel table:
JobA .03445
JobB .01366
JobC .93271
JobD .6335
Plus 65,000 more.
What I need to do, is to create four equal buckets based on the values. where the sum of all Jobs in each bucket come as close to the other three buckets as possible.
Is there a way to do this in Excel?
Thanks
You can try this approach based on the incremental percentage. So you sum each incremental job until your sum reaches 25% of total values (that is BucketA), jobs from 25-50% will be "BucketB", 50-75% "BucketC", and rest will go into "BucketD". Sum of values in each bucket should be pretty close since you have 65k of values.
enter this formula
=IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.25,"BucketA",IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.5,"BucketB",IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.75,"BucketC","BucketD")))
in cell C1 and drag it to the bottom.
There's lots of studies into algorithms that solve these types of problems. Your problem is actually the exact same format as the equal piles example in this article:
https://simple.wikipedia.org/wiki/P_versus_NP#Example
Considering the volume you're working with and the fairly narrow range of values, you could get a fairly good approximate solution by simply doing this:
Sort all items in descending order by value
In an adjacent column, put 1, 2, 3 and 4 against the first 4 values.
Use autofill to repeat that pattern against all values
You should now have 4 groups of fairly equal value

Adding a number to a date in excel (with an average and st dev)

I have a list of dates. They're dummy data for sign up dates.
I want to add another list that is dummy data for first usage dates.
To make the dates, I used this -
=RANDBETWEEN(DATE(2017,1,1),DATE(2017,6,30))
To make the first usages dates, I'm trying this -
=C6+RANDBETWEEN(0,100)
But, I don't want to just add a random number. I want to add a number from a normal distribution with a mean of 10 and a standard deviation of 30 (without going into negatives). Is that possible?
The following will generate a random number in normal distribution with a mean of 10 and deviation of 30:
= NORM.INV(RAND(),10,30)
The easiest way I can think of to exclude negative values is to just take the absolute value of this.
= ABS(NORM.INV(RAND(),10,30))
But, as already noted, if you exclude negative numbers (no matter how you decide to exclude them), then it isn't really a normal distribution anymore.
EDIT:
Another way to exclude negative numbers is the following:
Since NORM.INV(0.37,10,30) returns a value just above 0, you can use this knowledge to change the formula to only allow random values between 0.37 and 1 to be generated:
= NORM.INV(0.63*RAND()+0.37,10,30)
However, again I must point out this isn't a true normal distribution.

Taking the top values and averaging from data list in Excel

I have a data list in Excel, I am looking to take the top 3 values for each number, and get the average for those 3 values quickly. I often work with lists of up to 50,000 lines which at any one time could convert to over 10,000 different column A numbers.
I understand basic pivot tables to get an average after the top 3 values are collected, but need to find a way to remove all values that are not the top 3,
I trust this may be an extremely simple ask, or complex and thank you in advance for your help.
you can use =LARGE(Array, k) formula. For example, =LARGE(B:B, 1) is for 1-largest number, =LARGE(B:B, 2) is for 2-largest number etc.
If column contains many duplicates, and you want to get all occurences of top three values, use this formula to get all of them (put:
=IF(LARGE(B:B,ROW(A1))>=LARGE(B:B,COUNTIF(B:B,LARGE(B:B,COUNTIF(B:B,MAX(B:B))+1))+COUNTIF(B:B,MAX(B:B))+1),LARGE(B:B,ROW(A1)),"")

SUM the column in parts and it calculates different to the entire column SUM

If I sum a large column separately in individual sections, and sum those results, it adds up to be slightly different than if I sum the entire column at once.
The value is off by ~ 0.00000000001 - but my conditional formatting picks this up and it is different - despite the fact they are summing the same values.
The formatting of all cells are set to 'Number'.
I can't figure out why or how this would happen - does anyone have some idea? Has something like this happened to you before when working with accurate values?
I found this article on Microsoft's web site. It discusses limitations in Excel's arithmetic and possible ways to deal with them.
I can't imagine that your input numbers have 15 digits of precision, so probably the easiest solution is to round your multiplication/division/etc. results (which I assume you have to get you to the 15 decimal digits).

Resources