This is the general formula needed: if((b2-b1)=c1,True,False
However, I need b2-b1 to approximately equal c1, within 5 or so units (in this case seconds). Is there a function that could handle this?
You can also try this:
=ABS(B2-B1-C1)<=5
I think this should help you:
=AND(B2 - B1 >= C1 - 5, B2 - B1 <= C1 + 5)
This will return TRUE/FALSE only. You don't need to put IF if you don't want to type expressions.
=if(and( (b2-b1) >= c1 - 5, (b2-b1) < = c1 + 5 ), true, false)
Related
I have three pieces of information: quantity, weight per piece and a limit. What I need is for the weight per piece to multiple without passing the limit and the quantity.
I made a code, but the thing is the data of quantity varies and the code used is very long.
=ROUND(IFS((F13*G13)<H13,F13*G13,((F13-1)*G13)<H13,((F13-1)*G13),
((F13-2)*G13)<H13,,((F13-3)*G13)<H13,,((F13-4)*G13)<H13,,((F13-5)*G13)<H13,,
((F13-6)*G13)<H13,(F13-6)*G13,((F13-7)*G13)<H13,(F13-7)*G13,
((F13-8)*G13)<H13,(F13-8)*G13,((F13-9)*G13)<H13,(F13-9)*G13,
((F13-10)*G13)<H13,(F13-10)*G13,((F13-11)*G13)<H13, (F13-11)*G13,
((F13-12)*G13)<H13,(F13-12)*G13,((F13-13)*G13)<H13,(F13-13)*G13,
((F13-14)*G13)<H13,(F13-14)*G13,((F13-15)*G13)<H13,(F13-15)*G13,
((F13-16)*G13)<H13, (F13-16)*G13,((F13-17)*G13)<H13,(F13-17)*G13,
((F13-18)*G13)<H13,(F13-18)*G13),-2)+200
Here is the input and expected result, if no condition matches returns #N/A.
I don't know if the +200 at the end of the formula is supposed to be included in the limit or not so just adjust the formula accordingly
=ROUND(IF(G13*F13+200>=H13,H13,F13*G13+200),-2)
Multiply the quantity and the weight and add 200.
If the result is equal to or greater than the limit, set the result to the limit.
Otherwise use the results of the quantity * weight + 200
And then round it according to your initial formula
This is what your IFS() looks like:
IFS(((F13-0)*G13)<H13,(F13-0)*G13,
((F13-1)*G13)<H13,(F13-1)*G13,
((F13-2)*G13)<H13,,
((F13-3)*G13)<H13,,
((F13-4)*G13)<H13,,
((F13-5)*G13)<H13,,
((F13-6)*G13)<H13,(F13-6)*G13,
((F13-7)*G13)<H13,(F13-7)*G13,
((F13-8)*G13)<H13,(F13-8)*G13,
((F13-9)*G13)<H13,(F13-9)*G13,
((F13-10)*G13)<H13,(F13-10)*G13,
((F13-11)*G13)<H13,(F13-11)*G13,
((F13-12)*G13)<H13,(F13-12)*G13,
((F13-13)*G13)<H13,(F13-13)*G13,
((F13-14)*G13)<H13,(F13-14)*G13,
((F13-15)*G13)<H13,(F13-15)*G13,
((F13-16)*G13)<H13,(F13-16)*G13,
((F13-17)*G13)<H13,(F13-17)*G13,
((F13-18)*G13)<H13,(F13-18)*G13)
I see three issues:
the cases for 2 up to 5 are missing. Are you sure this is correct?
it looks like (for a general 'x'):
IF ((F13-x)*G13)<H13 THEN (F13-x)*G13, you can calculate the resulting value quite easily, isn't it?
why do you stop at 18?
You can simplify it as follows:
=LET(A, A2, B, B2, C, C2, seq, SEQUENCE(19,,0),
out, IF((seq > 1) * (seq < 6), 0, (A - seq)*B),
ROUND(#FILTER(out, (A - seq)*B < C, NA()), -2) + 200)
and extend it down, or use the array version as follow in cell D2:
=LET(A, A2:A3, B, B2:B3, C, C2:C3, seq, SEQUENCE(19,,0),
MAP(A,B,C, LAMBDA(x,y,z, LET(out, IF((seq > 1) * (seq < 6), 0, (x - seq)*y),
ROUND(#FILTER(out, (x - seq)*y < z, NA()), -2) + 200))))
Here is the output:
The implicit intersection operator (#) ensures to get the first element of FILTER result, which is equivalent to get the first condition that matches. If no condition matches, then it returns NA(). The name out, has the result in the same order it should be tested via IFS. Using SEQUENCE allows to simplify the process.
So I have a table, e.g.
- Category / Price
- A / 500
- A / 200
- A / 200
- B / 1000
- B / 2000
- B / 1000
How to find just ONE lowest number under each category by excel formulas, or VBA (even there are 2 lowest value under same category)?
My expected outcome will be:
- Category / Price / CheckLowest
- A / 500 /
- A / 200 / TRUE
- A / 200 /
- B / 1000 / TRUE
- B / 2000 /
- B / 1000 /
First time to ask question here. Thanks.
You may achieve it using an Array Formula as in Column C. You need to press Ctrl+Shft+Enter in order to run this formula correctly. However, you may drag the formula once entered in first cell (Cell C2 in this case).
=MIN(IF($A$2:$A$7=A2,$B$2:$B$7,""))
Column D has normal formula, just press enter as usual.
=COUNTIFS($A$1:A2,A2,$B$1:B2,C2)=1
Following is the screenshot with formulas:
And following is the output:
You may also solve it using VBA. in this case, you may try it first and let us know with your code that you tried, if facing any challenge.
I would echo the above comment about following the 'how to ask' guidelines.
However, I have created a UDF in VBA which should solve your problems. Assuming you are familiar with VBA, the code is as follows:
Function Price_Checker(Target As String, Rg As Range) As Double
Dim i As Long
Dim arr As Variant
Dim Price As Double
Dim Low_Price As Double
Low_Price = 1E+99
arr = Rg
For i = LBound(arr, 1) To UBound(arr, 1)
If arr(i, 1) = Target Then
Price = arr(i, 2)
If Price < Low_Price Then
Low_Price = Price
End If
End If
Next i
Price_Checker = Low_Price
End Function
Any questions, let me know
EDIT:
Equally, the MINIFS function seems to work just as effectively.
=MINIFS(Price Range, Product Range, Target Product)
Just replace the above with the actual cells/ranges
Use this array formula to C2 cell then drag down and right as needed.
=IF(SMALL(IF($A$2:$A$7=A2,$B$2:$B$7,""),1)=B2,TRUE,"")
Press CTRL+SHIFT+ENTER to evaluate the formula as it is an array formula.
I have an excel sheet with values in both negative and positive sign. Based on the values, I want them to assign a category. The excel sheet looks like this
I have to apply the formula on the SPI values.
I am using an IF statement.
The formula I am using is:
=IF(C3>=2,"EW",IF(1.5<=C3<=1.99,"VW",IF(1<=C3<=1.49,"MW",IF(-0.99<=C3<=0.99,"NN",IF(-1.49<=C3<=-1,"MD",IF(-1.99<=C3<=-1.5,"SD","ED"))))))
The problem is that every time it shows only "ED". It is as if it is skipping all the conditions and running only the last case. How can I fix this?
Try this, but check the values:
IF(C3>=2,"EW",IF(C3>=1.5,"VW",IF(C3>=1,"MW",IF(C3>=-0.99,"NN",IF(C3>=-1.49,"MD",IF(C3>=-1.99,"SD","ED"))))))
You could also consider vlookup() like this:
Which will be easier to maintain...
You can understand better what is going on using a beautifier (for example this) so your formula:
=IF(
C3 >= 2,
"EW",
IF(
1.5 <= C3 <= 1.99,
"VW",
IF(
1 <= C3 <= 1.49,
"MW",
IF(
- 0.99 <= C3 <= 0.99,
"NN",
IF(
- 1.49 <= C3 <=- 1,
"MD",
IF(
- 1.99 <= C3 <=- 1.5,
"SD",
"ED"
)
)
)
)
)
)
From your example is not clear which columns and row are, could you provide also excel file ?
Unlike many programming languages, Excel can't handle defining two delimiter at once for a variable. This won't work:
=IF(C3>=2,"EW",IF(1.5<=C3<=1.99,"VW", ...)
Since excel does not recognize 1.5<=C3<=1.99, it considers the statement as FALSE and checks what to do in that case, which at the end of your IF statement is "ED".
In your case, you have to use AND():
=IF(C3>=2,"EW",IF(AND(C3>=1.5,C3<=1.99),"VW", ...)
I haven't tested Solar Mike's solution, but his answers are generally pretty good. (Though the part with IF(C3>=--1.49,... probably needs to be rewritten to IF(C3>=-1.49,...) :)
Can someone help me out with a formula?
I have a large database and I`m trying to figure out, how to get the MAX amount used in January 2017 for a product X.
I have found the averages using - AVERAGEIFS(Avg.de.time!E3:E80231;Avg.de.time!A3:A80231;C2;Avg.de.time!C3:C80231;">="&H7;Avg.de.time!C3:C80231;"<="&EOMONTH(H7;0))
Column A - Item no.
Column B - Supplier name
Column C - Order date
Column D - Receive date
Column E - Delivery time (D-C)
I`ve spent too many hours on trying to figure this out.
So I m asking for Help :)
Using array formulae you can rewrite your AVERAGEIFS statement using a conditional array expression as follows:
=AVERAGE(
IF(
(
(Avg.de.time!A3:A80231 = C2) *
(Avg.de.time!C3:C80231 >= H7) *
(Avg.de.time!C3:C80231 <= EOMONTH(H7,0))
) > 0,
Avg.de.time!E3:E80231
)
)
I've just formatted the code to make it easier to see where each of the criteria, criteria_ranges and value_range appear however this will obviously be one long line in your cell.
It's now very simple to swap out AVERAGE at the start with MAX, MIN or another aggregate function with the rest of the formula remaining identical.
=MAX(
IF(
(
(Avg.de.time!A3:A80231 = C2) *
(Avg.de.time!C3:C80231 >= H7) *
(Avg.de.time!C3:C80231 <= EOMONTH(H7,0))
) > 0,
Avg.de.time!E3:E80231
)
)
As this is an array formula, you will need to type it into your Excel cell and hit Ctrl-Enter to make it an array formula. You can check this worked as curly braces {} will appear around the formula.
Can I sum these numbers with a formula ?
1
2
3
4
5
6
No, Im not looking for ="Sum(Cell___1:Cell_6)".
With "Product" you multiply - I just want to add them.
Like "=1+2+3+4+5+6", but just with a formula. Eg "formulaName(6)".
You mean:
Sum = n * (n+1) / 2, where n is the last number in the sequence?
Well... =6*(6+1)/2 ought to do it
For a more general approach, you could put 6 into, say, A1, and use
=A1*(A1+1)/2
Function GaussForm(ByVal x As Integer) As Integer
GaussForm = (x * (x + 1) / 2)
End Function
Not very Gaussian, but here's another way:
=SUM(ROW(A1:A6))
It's an array formula, so enter with Control+Shift+Enter