Show ratio as a percentage - excel-formula

Im trying to create a ratio between 3 numbers in excel, but want it represented in a percentage.
E.g.
ffffffff
As you can see in the picture.. I have three totals.. I want the ratio of these three numbers.. but represented as a percentage in each of the column. So how much percent is 110.28 in comparison to 154.67 and 32.29. By hand, I know they would be 37% | 52% | 11%

Depends on whether they're in separate cells or not - if they are, it's a simple one value over the sum of all values (if they're in A1, B1 and C1 it'll be A1/SUM($A$1:$C$1), B1/SUM($A$1:$C$1) and C1/SUM($A$1:$C$1) respectively):
but I'm guessing it's all in the one cell so the first ratio would be =LEFT(A9,FIND("|",A9,1)-2)/(LEFT(A9,FIND("|",A9,1)-2)+LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)+RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)),
the second ratio would be =LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)/(LEFT(A9,FIND("|",A9,1)-2)+LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)+RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1))
and the third ratio would be =RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)/(LEFT(A9,FIND("|",A9,1)-2)+LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)+RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)) - this is assuming it's held in A9 so if you have to put your value in another cell, you'll have to change any "A9" in my code to whatever cell you ratios are in:
Also, you have to format the cells to #.##% format but I assume you know how to do that?
Update:
=TEXT(LEFT(A9,FIND("|",A9,1)-2)/(LEFT(A9,FIND("|",A9,1)-2)+LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)+RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)),"#%")&" | "& TEXT(LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)/(LEFT(A9,FIND("|",A9,1)-2)+LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)+RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)),"#%") & " | " & TEXT(RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)/(LEFT(A9,FIND("|",A9,1)-2)+LEFT(RIGHT(A9,LEN(A9)-FIND("|",A9,1)),FIND("|",RIGHT(A9,LEN(A9)-FIND("|",A9,1)),1)-2)+RIGHT(A9,LEN(A9)-FIND("|",A9,FIND("|",A9,1)+1)-1)),"#%")

Related

How to refer to cells in a table based off a row value in Excel?

So l have a 2 column table, with the first column being size, and the next column being weight. I want to create an input where I get a user to type in the object size, and the next cell just spits out the corresponding weight. Is there anyway to do this in excel?
size weight
1 12
2 15
3 20
For example given the table above I want a user to just type in '2' for size, and an output cell will spit out '15'.
So far I've tried using structured table references, but they only refer to columns? I don't know how to get it to associate a size with the weight in the cell right beside it.
There isn't a formula I can use either that takes the size of the object and spits out the weight either, because the values come from a numerical solution that the scientific paper I'm looking at doesn't specify.
You can use vlookup like so:
=VLOOKUP(D1,A:B,2,0)
User enters the size in D1 and D2 spits out the weight.
Try just LOOKUP() Function
• Formula used in cell E2
=LOOKUP(E1,A2:B4)

Excel multiple variable lookups

have a table that i would like it to select the smallest size picture frame that could be used based on the size values,
basically return the smallest frame that would fit the image.
For example i have 4 standard sizes:
a b c
Size1 150 150
Size2 300 300
Size3 540 570
Size4 800 800
I want to have a size in another cell e.g. 290 x 300 and would like it to pick the smallest size possible to fit i.e. in this case size2.
I've followed a few guides and have the following that will print out the value if the values are exact but not if they are slightly under one of the options
=VLOOKUP($A$8,CHOOSE({1,2},$B$2:$B$5&", "&$A$2:$A$5,$C$2:$C$5),2,0)
Any helo / direction would be much appreactiated!
Thanks
Assuming order does matter (e.g. there is a difference between 500x550 and 550x500), you can use this array formula:
= INDEX($A$2:$A$5,MATCH(2,MMULT((E2:F2<=$B$2:$C$5)+0,{1;1}),0))
Note this is an array formula, so you must press Ctrl+Shift+Enter after typing this formula rather than just pressing Enter.
See below for working example.
Assuming order does not matter (e.g. there is not a difference between 500x550 and 550x500), the formula gets considerably longer because of reversing the order of the E2:F2 array. There is possibly a better way to do this but this is the easiest way I can think of to do it. Unfortunately Excel has no way of handling 3D arrays, otherwise this would be not much different from the original formula above. Anyway, here is the formula (line breaks added for readability)
= INDEX($A$2:$A$5,MIN(MATCH(2,MMULT((E2:F2<=$B$2:$C$5)+0,{1;1}),0),
MATCH(2,MMULT((INDEX(E2:F2,N(IF({1},MAX(COLUMN(E2:F2))-
COLUMN(E2:F2)+1)))<=$B$2:$C$5)+0,{1;1}),0)))
Note this is also an array formula.
See below, working example. Note how it yields the same result as above in every cell except cell G4, since again this is considering 550x500 and 500x550.
It is not clear what is in cell A8. Going by your question, I assume it must be dimensions in the format "W x H" (example: 290 x 300). If so, try:
In D2: 1
// Copy next down
In D3: D2+1
// Wherever you want it
=CONCATENATE("Size ",MIN(VLOOKUP(LEFT(A8,FIND(" ",A8)-1)+0,B2:D5,3,TRUE),VLOOKUP(RIGHT(A8,LEN(A8)-FIND("x ",A8)-1)+0,C2:D5,2,TRUE)))
Alternatively, if you split the width and height into 2 cells A8 and B8, this simpler version should do the trick:
In D2: 1
// Copy next down
In D3: D2+1
//Wherever you want it
=CONCATENATE("Size ",MIN(VLOOKUP(A8,B2:D5,3,TRUE),VLOOKUP(B8,C2:D5,2,TRUE)))
These assume the sizes all use a "Size #" naming convention. If otherwise, you could add another column at the right to equal column A, then use vlookup to identify the match, like this (again assumes "W x H" in cell A8):
In D2: 1
// Copy next down
In D3: D2+1
// Copy next down
In E2: =A2
// Wherever you want it
=VLOOKUP(MIN(VLOOKUP(LEFT(A8,FIND(" ",A8)-1)+0,B2:D5,3,TRUE),VLOOKUP(RIGHT(A8,LEN(A8)-FIND("x ",A8)-1)+0,C2:D5,2,TRUE)),D2:E5,2,FALSE)

Excel - formula to find how many cells to sum of N

I want to know how many cells it take to sum N. Please see following example:
number | cells to sum of 100
100 | 1
50 | 2
20 | 3
25 | 4
15 | 4
90 | 2
10 | 2
See the last column, it find the min number of current cell + previous cells to sum of 100.
Is there a way to do so?
Thanks.
In B2, array formula**:
=IFERROR(1+ROWS(A$2:A2)-MATCH(100,MMULT(TRANSPOSE(A$2:A2),0+(ROW(A$2:A2)>=TRANSPOSE(ROW(A$2:A2)))),-1),"Not Possible")
Copy down as required.
Change the hard-coded threshold value (100 here) as required.
As way of an explanation as to the part:
MMULT(TRANSPOSE(A$2:A2),0+(ROW(A$2:A2)>=TRANSPOSE(ROW(A$2:A2))))
using the data provided and taking the version of the above from B5, i.e.:
MMULT(TRANSPOSE(A$2:A5),0+(ROW(A$2:A5)>=TRANSPOSE(ROW(A$2:A5))))
the first part of which, i.e.:
TRANSPOSE(A$2:A5)
returns:
{100,50,20,25}
and the second part of which, i.e.:
0+(ROW(A$2:A5)>=TRANSPOSE(ROW(A$2:A5)))
resolves to:
0+({2;3;4;5}>=TRANSPOSE({2;3;4;5}))
i.e.:
0+({2;3;4;5}>={2,3,4,5})
which is:
0+{TRUE,FALSE,FALSE,FALSE;TRUE,TRUE,FALSE,FALSE;TRUE,TRUE,TRUE,FALSE;TRUE,TRUE,TRUE,TRUE})
which is:
{1,0,0,0;1,1,0,0;1,1,1,0;1,1,1,1}
An understanding of matrix multiplication will tell us that:
MMULT(TRANSPOSE(A$2:A5),0+(ROW(A$2:A5)>=TRANSPOSE(ROW(A$2:A5))))
which is here:
MMULT({100,50,20,25},{1,0,0,0;1,1,0,0;1,1,1,0;1,1,1,1})
is:
{195,95,45,25}
i.e. an array whose four elements are equivalent to, respectively:
=SUM(A2:A5)
=SUM(A3:A5)
=SUM(A4:A5)
=SUM(A5:A5)
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
I did the first 3 with an excel formula:
D3>100
C4 is where your numbers start, so C4=100, C5=50 etc.
Formula is on D4, D5, D6 etc
On D4:
=IF(C4>=D3;1;"False")
On D5:
=IF(C5>=D3;1;IF(C5+C4>=D3;2;"Error"))
On D6:
=IF(C6>=D3;1;IF(C6+C5>=D3;2;IF(C6+C5+C4>=D4;3;"Error")))
You can keep doing this, just keep replacing "Error" with an longer/updated version of IF(C6+C5+C4>=D4;3.
I don't know if this is the best way, but this will achieve it.
One way to solve this is to create an NxN matrix of equations instead of just a column. An example picture is provided. Columns E through I are hidden. The last column on the right determines the number required
Theoretically, you can also hard code the equations if the number of rows needed to get to 100 is a known small number. For example, if the number of rows is always four or less, C8 would be =IFS(B8>=100,1,SUM(B7:B8)>=100,2,SUM(B6:B8)>=100,3,SUM(B5:B8)>=100,4). BTW, you'll run into sum boundary problems with this equation on the first, second, and third rows. Therefore, the first row will need to be =if(B8>=100,1,""), the second row would be =IFS(B9>=100,1,SUM(B8:B9)>100,2,TRUE,"") and so on.

Sum of numbers + 0

I am having a problem with a small number. I am using SUM function to sum certain numbers. If I add a zero to the range, it is not displaying zero. I don't know why.
A1
=SUM(B1:R1)*-1
C1 to L1
266864 -100000 -15136.15 -23688.82 -120870 -7169 -5550 1224 -0.03 4326
A2
=SUM(B2:R2)*-1
C2 to M2
=SUM(C3:C3) =SUM(D3:D3) =SUM(E3:E3) =SUM(F3:F3) =SUM(G3:G3) =SUM(H3:H3) =SUM(I3:I3) =SUM(J3:J3) =SUM(K3:K3) =SUM(L3:L3) =SUM(M3:M3)
A3
=SUM(B3:R3)*-1
C3 to M3
266864 -100000 -15136.15 -23688.82 -120870 -7169 -5550 1224 -0.03 4326 0
A1 is displaying 0, but A2 and A3 displays 9.09E-13
The number 9.09E-13 is another way (scientific notation) of saying 0.000000000000909495, a very small decimal number. What you are experiencing is a 15 digit precision floating point error.
    
Typically, you would use the ROUND function or something similar to remove the error (if you have to).
See Floating-point arithmetic may give inaccurate results in Excel for more information.
as I think,
might be some different formula on A1 cell is already placed or the type of A1 Cell is int and Value becomes in decimal or else, so make try this formula in different cell.
I wonder why you are using =SUM(C3:C3) etc. That is, Why use the sum function on a single cell. Unless there is a specific reason, I suggest you use = C3 instead. I've found that using the summation on a single cell can sometimes return answers that are incorrect. Don't know why, but it does. Therefore, long ago I quit using the sum unless there is a range that includes more than one cell.

Need help converting a range of numbers to text in excel

I'm using MS Excel 2010; I'm a total newbie to using functions, so be kind when answering.
I'm creating a sports grading sheet that will help instructors calculate the test scores for their students. So far I've set up excel to add a students individual points in a column and then give a percentage value out of 100%
What I want to do now is have the percentage value be converted to a selection of text result. For example, if a student gets 76.76% on their test; then their mark is considered a 'conditional pass' as it falls between the ranges of 75%-85%
I need excel to determine which range their test results fall under and then automatically enter the text result in the cell underneath, e.g.:
Name: Student
Percentage total: 76.76%
Result: Conditional Pass
I'm going to have to assign every possible number (including decimal points) to one of three text results.
Hope this makes some sense.
Thanks!
Jeepeds answer is a great way to do this, so I'll help you a bit more.
Jeeped specified a table of values in his answer using {0,0.5,0.75,0.85,0.95} which will work, but it means the values are in every formula of every cell. The way below allows you to maintain a separate list of values that define the result text associated with a range of percentages
I would set up a a range with a table of values as follows.
LowerMark UpperMark ResultText
0.0 0.50 Fail
0.50 0.60 Ok Pass
0.60 0.75 Contional Pass
0.75 0.85 Good Pass
0.85 0.90 Excellent
0.90 1 Brilliant
1 9999 This should never happen
Lets say the above table is in sheet2 in cells A1 to C7.
Note that the upper mark column is not really needed, but it helps "read the table". (It could be set using a formula that gets it's value form the next rows LowerMark)
In you main list that has the pupil marks, the cell that you want to display the "Result Text" will need a formula like the following. This formula refers to cell D6 which is the cell that has the numeric percentage they obtained.
=VLOOKUP('Sheet2'!$A$1:$C$7, D6, 3, TRUE)
Note that the table of values assumes that you are calculating and storing the percentage for each child as a number that ranges from 0 to 1 (not 0 to 100)

Resources