Excel Help:
How to find middle value in excel given 35-39 lbs. I want the answer as 37(Middle number in range)?
For Example in Column A below:
A
----
35- 39 lbs
40- 45 lbs
The answer should be
A
----
37
43
And How to retain only the first value for above example
A
----
35
40
One is the "Average" =Average(35,39)=37 and the other is the "Min" =Min(40,43) =40. If you want the physical middle number in a group like '35,36,37,40,43' you can use "Median" =median(35,36,37,40,43) = 37
One option is as follows
Say Cell A1 = 35- 39 lbs
In B1, type = =MID(A1,1,2) to extract 35.
Then, in C1, type =MID(A1,5,2) to extact 39.
In D1 for instance, you can now average C1 and B1 with =AVERAGE(B1, C1).
Related
I have two separate tables in an Excel worksheet, as illustrated below.
Columns A, B, E, F and G are my input values;
I want a formula that generates the values in Column C
(shown in italics):
A
B
C
D
E
F
G
1
Name
Value
Type
Type
Lower
Upper
2
Andy
35
Spam
Spam
35
39
3
Mark
85
Foo
Ham
25
27
4
Pat
28
N/A
Eggs
91
95
5
Deb
93
Eggs
Foo
82
86
6
Emily
92
Eggs
Bar
65
69
7
Greg
22
N/A
8
Gary
67
Bar
For each row in the first table (i.e., each person),
I want to find that person’s Type based on their Value (Column B)
by finding the row in the second table where the person’s Value
falls within the Lower→Upper range (Columns F and G).
So, for example, Mark (Row 3) has a Type of “Foo”
because his Value (85) falls between 82 and 86,
associated with “Foo” in Row 5 of the second table.
Note that Pat’s Value is 28 (Row 4), which does not match any range.
The ranges are inclusive.
For example, Andy’s Type is “Spam” (Row 2) even though his Value (35)
equals the Lower end of the range for “Spam” (Cell F2).
I know nested IFs are quite hard to debug in Excel,
so I’d like to avoid that if possible.
Modify your source table to show the lower limit for each grade and then use a VLOOKUP with a approximate match
Update to show how to include blank ranges
Filter Solution
If you don't have access to the FILTER function, one option is an INDEX/MATCH array formula, which will need confirmed with Ctrl+Shift+Enter.
=INDEX($F$2:$F$6,MATCH(1,($G$2:$G$6<=B2)*($H$2:$H$6>=B2),0),)
Another option is LOOKUP, which does not need Ctrl+Shift+Enter.
=LOOKUP(1,1/(($G$2:$G$6<=B2)*($H$2:$H$6>=B2)),$F$2:$F$6)
I have a file which looks like:
E1 32 45 + Apple
E2 54 76 + Apple
...
...
-E2 300 400 + Apple
-E1 540 760 + Apple
E1 560 600 - Orange
E2 340 440 - Orange
...
...
-E2 30 40 - Orange
-E1 20 7 - Orange
Here E for each unique value from last column can range from 1 to 100. And the last column can go till several thousand unique fruits. I want to estimate the average of difference in first E's (E1) from each unique value of last column.
E1 ((45-32)+(600-560))/2 = 26.5
E2 ((76-54)+(440-340))/2 = 61
I want the calculate E1, E2 and E3, and also -E3, -E2, -E1, where -E1 is last E in every unique entry from last column, similarly -E2 and -E3 are second and third last Es.
I tried groupby from pandas to approach this problem:
df1.groupby(str(line[4]))[line[2]-line[1]].mean()
I dont not know whether groupby is the right approach or not, and I am having hard time making a loop for this case. `
I have a sheet with product names in column I and then dates from there on. For each date there are numbers of how many pieces of a certain product have to be made. I'm trying to sum all those numbers based on a product type, i.e.:
I K L M ...
30.8. 31.8. 1.9. ...
MAD23 2 0 45 ...
MMR32 5 7 33 ...
MAD17 17 56 0 ...
MAD: 120 (2+0+45+17+56+0)
MMR: 45 (5+7+33)
What I'm doing now is sum the row first:
=SUM(K6:GN6)
MAD23 = 47
MMR32 = 45
MAD32 = 73
And then sum those numbers in column J based on part of the product name in column I:
=SUMIF(Sheet1!I6:I775;"MAD*";Sheet1!J6:J775)
MAD = 120
MMR = 45
Is it possible to do this with just one formula per criteria?
Just trying it on those three rows, I get
=SUM($K$6:$M$8*(LEFT($I$6:$I$8,LEN(I10)-1)=LEFT(I10,LEN(I10)-1)))
which is an array formula and must be entered with CtrlShiftEnter
That's assuming that I10 is going to contain some characters followed by a colon and you want to match those with the first characters of I6:I8.
=SUM(IF(MID(Sheet1!I6:I775,1,3)="MAD",Sheet1!k6:gn775,""))
With ctrl +shift+enter
I'm trying to pair a vlookup with a max function. For some reason it only returns #ref every time I try to use it though.
My sheet looks like this:
A - B - C - D - E - F - G
1...
5 - Prod5 id1 $100 $125 $155 $110 $150
6...
A:G is named buyAverages
C:G is named buyAveragesPrices
What I want to do is have a vlookup go and find a value in Col A and then return the highest value in that Col. So example:
A - B
1 - Prod5 *return highest price for Prod5
What I wrote in B1, which failed:
VLOOKUP(A1,buyAverages,MAX(buyAveragesPrices))
So how do I achieve this lookup? Everything I have found is how to use MAX for the lookup value, but nothing to use max on the returned index.
Try this
=MAX(IF(A:A="Prod1",C:G))
This is an Array Formula. i.e you have to press Ctrl+Shift+Enter
If there's only one instance of each Product then you can use INDEX/MATCH like this
=MAX(INDEX(C2:G100,MATCH("Prod 1",A2:A100,0),0))
Longer than Sid's suggestion but doesn't need CSE and might be more efficient if you only have a single match
If you have that formula in Z2, for example, you can use this version to get the location from row 1
=INDEX(C1:G1,MATCH(Z2,INDEX(C2:G100,MATCH("Prod 1",A2:A100,0),0),0))
You can have all in one cell using Vlookup and Max with a nested formula. For example at the top of the page:
A1 = Select the name of the product you want to find the max
A2= MAX(BUSCARV($A$1;$A$3:$F$11;3;FALSO);BUSCARV($A$1;$A$3:$F$11;4;FALSO)
;BUSCARV($A$1;$A$3:$F$11;5;FALSO);BUSCARV($A$1;$A$3:$F$11;6;FALSO))
It's long but you only have to type it once. With this formula we get all the different amounts in each column and then we ask for the maximum. It works if all the products are different. Change the name of the product and you'll find the MAX in the table.
Example Prod8
Prod8 41 ; If we change and you select in A1 Prod4 you'll
get 70 and so on..
Prod1 id1 100 125 155 110
Prod2 50 25 20 75
Prod3 60 65 15 90
Prod4 70 12 50 43
Prod5 100 200 80 25
Prod6 20 28 40 40
Prod7 14 43 60 80
Prod8 22 33 15 41
Prod9 65 48 50 70
Select your range accordingly.
You also could include in A1 a match code to select the name of your products..
I'm using Excel 2013 and I have had to create a If statement which basically chooses a student's grade depending on a certain mark number (obviously, nesting is needed) Here is the If statement I created:
=IF(E2<=20,"N",
IF(OR(E2>=21,E2<=25),4,
IF(OR(E2>=26,E2<=32),"5C",
IF(OR(E2>=33,E2<=38),"5B",
IF(OR(E2>=39, E2<=44), "5A",
IF(OR(E2>=45, E2<=53), "6C",
IF(OR(E2>=54, E2<=61), "6B",
IF(OR(E2>=62, E2<=71), "6A",
IF(OR(E2>=72, E2<=87), "7C",
IF(OR(E2>=88, E2<=103), "7B",
IF(OR(E2>=104, E2<=120), "7A")))))))))))
The error I receive is:
the specified formula cannot be entered because it uses more levels of nesting than allowed in the current file format
My question is, how do I shorten this statement to allow Excel to use it?
Place the logic in the spreadsheet cells. One column for the minimum score, and one column for the grade-:
A B
1 0 N
2 21 4
3 26 5C
4 33 5B
5 39 5A
6 45 6C
7 54 6B
8 72 7C
9 88 7B
10 104 7A
Then do a vlookup to get the grade from the actual score. vlookup will find the highest value in the A column that is less that the lookup value of 38.
In the example vlookup below 38 is the score, A1:B10 is the lookup table 2 is the 2nd column (in this case the B column) that contains the result (the grade).
=VLOOKUP(38, A1:B3, 2, TRUE)
You can also use the following formula.
=LOOKUP(E2;{0;21;26;33;39;45;54;62;72;88;104;121};{"N";4;"5C";"5B";"5A";"6C";"6B";"6A";"7C";"7B";"7C";"No match"})
There are a few different solutions. AND agreements using OR instead of the first that comes to mind.
=IF(E2<=20,"N",
IF(AND(E2>=21,E2<=25),4,
IF(AND(E2>=26,E2<=32),"5C", ...
The best way, in my opinion, is to write a UDF. Then you can use VBA and a CASE statement.
Experiment with this code in VBA to create a UDF named GRADE() - just type it into a MODULE in the VBE:
Function Grade(Marks)
Dim Score As Integer
Score = Marks * 1
Select Case Score
Case 1 To 20
Grade = "N"
Case 21 To 50
Grade = "C"
Case 51 To 90
Grade = "B"
Case 91 To 120
Grade = "A"
End Select
End Function
Then use the Function GRADE() as you would any other function but type the address of the argument - like this GRADE(B7) to use it
=+IF(O3="Negative","Negative",IF(P3="Negative","Negative",IF(Q3="Negative","Negative",IF(R3="Negative","Negative",IF(O3="Refer","Refer",IF(P3="Refer","Refer",IF(Q3="Refer","Refer",IF(R3="Refer","Refer","Positive"))))))))
I find the final status in 4 cells have positive,negative,refer,pending or blank