Excel Min IF Not Equal to - excel-formula

I'm banging my head off a desk trying to use a simple formula.
I've used MIN IF and MAX IF many times however I now want to use it where my operator is not equal to (<>) and it just doesn't like me.
I have a list of categories where "Unknown" is usually the lowest percentage but wants to be excluded from this return.
It is currently returning Unknowns percentage but will return another categories if it is lower
Part of the formula causing me headaches
=MIN(IF('STP% Division'!$K:$K<>"Unknown",'STP% Division'!$L:$L))
Overall Formula
=ROUND(MIN(IF('STP% Division'!$K:$K<>"Unknown",'STP% Division'!$L:$L))*100,0)&"%"
Help

Got it, needed to be an Array Formula and wouldn't work on entire columns, just the specific range
=ROUND(MIN(IF('STP% Division'!$K4:$K11<>"Unknown",'STP% Division'!$L4:$L11))*100,0)
Confirmed with CTRL + SHIFT + ENTER instead of just ENTER, this looks like this in the cell - the braces around the whole formula are not entered manually.
{=ROUND(MIN(IF('STP% Division'!$K4:$K11<>"Unknown",'STP% Division'!$L4:$L11))*100,0)}

Related

Find minimum value from multiple regularly spaced columns in excel

I have the following problem I need to address:
I have quotations from multiple vendors for multiple types of products. I need to find the product wise minimum and 2nd lowest quotations. The sheet looks somewhat like this:
I want the output in the following format:
Now, the problem is that the number of vendors is 300, and using the regular formula: min(number1,number2,number3,...) is very tedious and error prone as I have to manually click each entry for each vendor like min(B3,F3,I3,... 300 entries) for product 1.
Another problem is for 2nd Lowest Quote Here, excel does not accept discontinuous array like min function. Which means I cannot enter the formula small(B3,F3,I3,2) as it gives you have entered too many arguments error in this case.
I need to find some way to get around this problem. Please help me out with this problem.
Another option in non-array formula solution
Assume your data put in A1:P5
"Minimum quote" in K3, copied across to M3, and all copied down :
=AGGREGATE(15,6,$B3:$J3/($B$2:$J$2=K$2),1)
"2nd lowest quote" in N3, copied across to P3, and all copied down :
=AGGREGATE(15,6,$B3:$J3/($B$2:$J$2=N$2),2)
Data
You could try an array formula like so:
=MIN(IF($B$2:$J$2=K$2,$B3:$J3))
Make sure you hit Ctrl+Shift+Enter. What it does is it only extracts values corresponding to the specific product using the if statement, min then finds the minimum value out of that range.
Same applies to the SMALL function, it can take a range but we must filter that range using the IF function to get only the columns we want for that product, this also requires to be an array formula by entering it with Ctrl+Shift+Enter
=SMALL(IF($B$2:$M$2=N$2,$B3:$M3),2)

Excel calculate SUM of differences when cell addresses are not fixed

In Excel I have a list of employees (see image) and I want to store their salary update history. For each salary update, I want to calculate the difference in their total salary. I'm unable to create a formula to calculate this and SUM() the updates per period for me.
The image below demonstrates my spreadsheet and the desired salary update total (I did calculations manually, bet need a formula for this). In reality, there will be a few dozens of employees, so the requirement for the formula is to be dynamic and not contain manual "+" for each row.
NOTE: For some people their salary can stay unchanged and there are not any values in some cells. It's the main challenge, since we have to find the value of the "previous salary" for an employee, because it's not necessary stored in the previous cell. Otherwise, I could have used a simple array formula, like:
{=SUM(G3:G6-H3:H6)}. But unfortunately, it does not work in this case (there can be no value in the H column, so we have to find where it actually is).
Also, the formula should work correctly with filtering: is some row is filtered out (person is inactive, see picture), this row/cell should be ignored.
Can anybody help me with this formula that I'm struggling with?
This will do what you ask, not my my best work.Column "I"is still =SUM. Remember to press Ctrl + shift + enter. Then drag the formula where you want it to apply.
{=IFERROR(IF(E3="",E3,E3-INDEX(F3:$I$3,MATCH(FALSE,ISBLANK(F3:$I$3),0)))
+IF(E4="",E4,E4-INDEX(F4:$I$4,MATCH(FALSE,ISBLANK(F4:$I$4),0)))
+IF(E5="",E5,E5-INDEX(F5:$I$5,MATCH(FALSE,ISBLANK(F5:$I$5),0)))
+IF(E6="",E6,E6-INDEX(F6:$I$6,MATCH(FALSE,ISBLANK(F6:$I$6),0)));SUM(E3:E6))}
This formula does give the same answers as yours on the test data as below, BUT it is making a very big assumption - that the last recorded salary is always the largest one.
=SUM(IF(D3:D6="",0,D3:D6-SUBTOTAL(4,OFFSET(E3,ROW(D3:D6)-ROW(D3),0,1,COLUMNS(E3:$J3)))))
Must be entered as an array formula using CtrlShiftEnter
If you want to ignore hidden rows, plz use the form of Subtotal that ignores hidden cells
=SUM(IF(D3:D6="",0,SUBTOTAL(104,OFFSET(D3,ROW(D3:D6)-ROW(D3),0,1,1))-SUBTOTAL(104,OFFSET(E3,ROW(D3:D6)-ROW(D3),0,1,COLUMNS(E3:$J3)))))

SUMIF for a wider range

I have a problem that has been nagging me for a while now. I am a novice in Excel. Hence excuse me if this comes across as silly.
I have the following array of data:
I need to obtain the sum of values corresponding to the row entry "book".
I have used the formula sumif(B4:F7,"book",C4:F7). However excel returns the value in column c alone (i.e value returned is 10).
Update
I ammended my formula as follows:
I now obtained the correct sum - i.e 70. However, I deal with large volumes of data and using this formula is not efficient. Can anyone suggest a quick workaround for this?
Your guess is correct. There is a simpler way, but it is not easy to find it out for a novice user. You will need to use an array formula to do what you need.
Type this formula:
=SUM(IF($B4:$B7="book",$C$4:$F$7,0))
and enter it using Ctrl + Shift + Enter instead of just Enter
You can see the result in this picture (my delimiter is ; while yours will be ,, but that does not make a difference):

Excel Q - SUMIFS with a 2 dimensional array

I have a 2-D array: dates on a horizontal axis and identification numbers on a vertical axis.
I want the sums conditioned on a particular date and ID, and I want to know how to do this using SUMIFS.
For some reason, it seems like I cannot since the array is 2-D while the criteria ranges are 1-D. Can anyone give me any advice on other formulas I can use?
In other words, I would like to add the values that satisfy the ID and date I select; there is one or more data point that satisfies the conditions. This is why the SUMIF function is relevant.
With this data you will not be able to use a SUMIF forumula. Here's a formula you can use:
=SUM(IF($B$2:$B$6=C9,IF($F$1:$K$1=B9,$F$2:$K$6)))
Change the addresses where appropriate and be sure and enter it by pressing CTRL + SHIFT + ENTER. You can also use the below formula to avoid pressing CTRL + SHIFT + ENTER:
=SUMPRODUCT(($B$2:$B$6=C9)*($F$1:$K$1=B9)*$F$2:$K$6)
Assuming that you're looking for an intersection of an ID and a Date, you can use the following:
=INDIRECT(ADDRESS(MATCH([ID Number],A:A,0),MATCH([Date],1:1,0)))
INDIRECT allows you to type in an address as plain text and returns the value
ADDRESS turns the numbers for rows and columns into a regular address
MATCH finds where in a row or column a given value is located.
I just wanted to add that the array version of the 2D summation in the answer above
=SUM(IF($B$2:$B$6=C9,IF($F$1:$K$1=B9,$F$2:$K$6)))
will work better if your data table $F$2:$K$6 has blanks (or other non-numeric values) because it will sum only the values that match criteria specified by $B$2:$B$6=C9 $F$1:$K$1=B9 and ignore all others.
Generally, you probably will not have blanks or other non-numeric values in your data table but I just wanted to throw this out there in case it helps someone. It certainly helped me, and I had fun playing with both 2D summation examples above. :)

CountIF error with <0

I would need some help again with another excel countif expression. I have the line i2:al2 which contains leftover stock data.I am building a worksheet to calculate remaining stocks in % as per supervisor's wish.
As I am working with %, for example if I say that 90% sales that means we have 103 stock left and with 91% sales I have 100 stock left.
Anyways I got around to count the number of stock left in line i2:a12 using countifs.
Example if I need to calculate leftover stock for sales at 90% which means leftover stock level of 100 to 102. I have used :
=countif(range,">100")-countif(range,">102")
This method seems to work till I reach negative numbers, i.e. oversales. For example, if I try to do the following:
=countif(range,"-100")-countif(range,">0")
the formula seems to stop working. If I count manually using a conditional formatting I get a totally different answer for the oversales.
Maybe I am getting the logic of the countif function wrong. My purpose for the expressison is:
=count(in range, values >=X & <=Y)
As I have only access to excel 2003 I cannot use Countifs method. Anyone could help me on this issue?
Many thanks.
You can use an array formula:
=SUM((range>=x)*(range<=y))
For that to work, you need to press CTRL-SHIFT-ENTER for that to use array formula.
Alternatively, using what simoco gives in the comment works too without having to save as array formula.

Resources