I'm not the best with technical descriptions but please bear with me.
The task before me:
A large spreadsheet with a column of values that need to be reviewed and a different number input beside them. Unfortunately the number is not simply "value, less 15% though it's close". I will need to have a list of specific "find/replace" commands for my formula.
Example:
3.02
6.65
1.54
3.02
And I need to format it such that it says:
3.02 2.80
6.65 5.60
1.54 1.40
3.02 2.80
My idea was something along the lines of =if(A1=3.02,2.80,=if(A1=6.65,5.60,=if(A1....
Then I'd be able to just paste this formula and drag down the entire spreadsheet.
Unfortunately that didn't work and so I come to you all for help.
Please save me tons of time and figure out how I can make this spreadsheet generate it's own values!
Thanks,
Mike
I would make a little lookup table of the specific replacements:
A B
1 lookup result
2 3.02 2.8
3 6.65 5.6
4 1.54 1.4
5 3.02 2.8
And then you could set up a formula like this:
9 value result
10 3.02 =VLOOKUP(A10,A$2:B$5,2,FALSE)
11 6.65
12 1.54
13 3.02
14 1.54
And you can drag that formula down the rest of the table.
Beware of the A$2:B$5 - if your lookup table is differently-sized, it will need to change.
OR, to keep more along the lines of what you have, try a formula like this:
=if(A1=3.02,2.80,if(A1=6.65,5.60,if(A1....
The change I made was to remove the extra = before the inner IF function calls.
It is hard to guess how many different value do you have. Based on your given sample data you can use XLOOKUP() function like below if you have Excel-365.
=XLOOKUP(A1,{5.6,2.8,1.4},{5.6,2.8,1.4},"",-1)
Related
I am helping my son with his math homework, specifically statistics and this is the dataset:
1 2 3 4 5 6 7 8 9 10
I have 10 numbers from 1 to 10.
15 percentile:
in Excel I use the PERCENTILE or PERCENTILE.INC function with .15 and the result is 2.35, why?
The book way. .15*10 = 1.5 th number. There is not 1.5 number so round up to 2 or 2.
20 percentile:
In excel I get 2.8.
Book version: .2*10 = 2 (exact) so take average of 2nd and 3rd value for 2.5
50 percentile or median:
In excel I get 5.5.
Book version .5*10 = 5 (exact) so take average of 5th and 6th value for 5.5 (only match)
75 percentile 7.75:
Book, .75*10 * 7.5 so round up to 8.
Excel
80 percentile:
Excel I get 8.2
Book, .8108, average of 8 and 9 is 8.5.
Obviously Excel is doing more advanced math and additional smoothing, however I have not been able to find the exact math it uses replicate it, hence I will say it is wrong. Other programs and statistical packages match Excel so it is correct, but not useful as I need it.
How can I get Excel to give me the Book version of answers or at least replicate the Excel answers with paper and a basic calculator.
Most importantly I need to find a way to explain to my son that it is OK that the results don't match that he should do it the book way, at least for now or in school.
EDIT: After posting, SO found and similar question: Different results for percentiles in SAS and Excel It seems SAS gives the same results as the book version. The answer there is that Excel and most packages use different interpolation methods. However I need a better explanation for my son and maybe a way to create a proper percentile function for my son, but hopefully without VBA.
ID-A
Val-A
22
17.1
4
16.0
7
16.5
ID-B
Val-B
9
15.5
2
19.5
45
17.5
These tables (4 columns in Excel) are my input (here reduced to a minimal working example).
The order of the values in column Val-A (here: largest, smallest, middle) is the order, in which Val-B should be sorted.
That said, the second table should look like:
ID-B
Val-B
2
19.5
9
15.5
45
17.5
The order of the values in the input columns Val-A and Val-B as well as the IDs in ID-A and ID-B are arbitrary.
It is also important to note that the values in Val-A and Val-B are never equal, i.e. none of the values in Val-A will be a value in Val-B.
How can I achieve this in Excel?
I'm suggesting you rank the values in the first table, then match the ranks in the second table to those ranks to get the sort order that you need.
Using ranges:
=SORTBY(D2:E4,XLOOKUP(RANK(E2:E4,E2:E4),RANK(B2:B4,B2:B4),SEQUENCE(3)))
or using structured references:
=SORTBY(Table2,XLOOKUP(RANK(Table2[Val-B],Table2[Val-B]),RANK(Table1[Val-A],Table1[Val-A]),SEQUENCE(ROWS(Table2))))
EDIT
Case where second table has more rows than first.
A bit pushed for time on this so this isn't fully checked. I couldn't get Rank to work with filter, although the documentation suggestions that it should work, but it's OK with index. To avoid a lot of repetition, I've put it in a Let statement like this:
=LET(FilValB,INDEX(TableB[Val-B],1):INDEX(TableB[Val-B],ROWS(TableA)),
FilTableB,INDEX(TableB,1,1):INDEX(TableB[Val-B],ROWS(TableA)),
SORTBY(FilTableB,XLOOKUP(RANK(FilValB,FilValB),RANK(TableA[Val-A],TableA[Val-A]),SEQUENCE(ROWS(FilTableB)))))
All the single use VLOOKUP formulas work perfectly, but the formula below is a nested VLOOKUP and always fails.
=VLOOKUP(VLOOKUP(V2,PRAISe,2,FALSE)-VLOOKUP(D2,PRAISe,2,FALSE),Progress,2,FALSE)
When I step thought the formula the nested VLOOKUPS work fine and resolve to the correct decimal value. When the top level vlookup searches for that decimal value I always get a no value found error.
The lookup ranges are as follows:
PRAISE Lookup
1- 1.20
1+ 1.80
1= 1.50
2- 2.20
2+ 2.80
2= 2.50
etc. etc.
Grade Lookup
1.20 1-
1.50 1=
1.80 1+
2.20 2-
2.50 2=
2.80 2+
etc. etc.
Progress
0.00 0
0.30 1
0.60 2
0.90 3
1.20 4
etc. etc.
Things I have tried.
At first I thought it was due to the decimal places and an exact match problem, so I multiplied all my results by 10, so I was only working with whole numbers. Unfortunately I got the same result.
I have also tried spitting the formula across two columns. Again the subtraction works and resolves to a decimal number. However when I then try and look that number up as a separate statement it still fails.
This may be due to the way that numbers are stored in Excel. If you round the subtraction or use TRUE as the last argument in the outer lookup, the formulas seem to work. I changed V2 to A2 for sake of the screenshot.
=VLOOKUP(ROUND(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),1),Progress,2,FALSE)
=VLOOKUP(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),Progress,2,TRUE)
But there are combinations where the subtraction of the VLookup does not have an exact match in the Progress table, for example 2+ returns 2.8 and 1- returns 1.2. The subtraction result is 1.6 and a Vlookup with FALSE on the Progress table will return an error, while the vlookup with TRUE as the last parameter will return the next smallest match.
So check your V2 and D2 cells for combinations that are not found, and determine if you can get away with rounding or if you need to use TRUE in the outer lookup.
Aren't you missing some parenthesis in there to make it clear to the formulas the order of operations you intend?
=VLOOKUP((VLOOKUP(V2,PRAISe,2,FALSE))-(VLOOKUP(D2,PRAISe,2,FALSE)),Progress,2,FALSE)
I have some ranked data that looks something like this in an excel spreadsheet.
1.3
1.3
1.3
1.4
1.6
1.6
1.7
1.8
1.9
2
2
2.3
2.3
2.3
2.4
2.7
3.1
3.3
3.3
3.4
3.4
4
4.2
4.5
4.7
4.9
5.8
6.1
6.7
I'm looking to make a calculator for the Mann-Whitney U-test and for that I need to rank these samples, simple enough using the =RANK() function in Excel, but I need to settle ties in the ranks for the test. The Mann-Whitney method involves taking the average of the ranks. For example, my first 3 values are 1.3 so I need excel to assign all 3 of these values the rank of (1+2+3)/3 (=2). At the moment the =RANK() function just ranks all 3 as 1.
I've seen some similar questions here solved using the IF command but have had trouble appling them to my data.
Any help would be greatley appreciated.
Thanks,
Sam
Which version of Excel are you using? If you have Excel 2010 or later then there is a specific function for this, RANK.AVG, e.g. if your data is in A2:A30 use this formula in B2 copied down to rank as required
=RANK.AVG(A2,A$2:A$30,1)
In earlier versions of Excel you can use this formula to give you the same results
=RANK(A2,A$2:A$30,1)+(COUNTIF(A$2:A$30,A2)-1)/2
You can cheat a little to get duplicates with different ranks. You will need a helper column
I'm going to assume the list of numbers starts # A1...
in B1, enter the formula =A1+ROW()/10000 - this will add on a small amount to the number - not enough to put it into the next value, but enough to distinguish between values
In C1, enter the formula =RANK(B1,$B$1:$B$29,1) to get the new rankings, with no duplicates.
Then copy B1 & C1 down to complete the table. You can hide column B if you don't want the intermediate cells shown
I am trying to develop the formula in excel to look up multiple criteria. Specifically, how do I pull in a value for apples in NYC for location (B)?
Northeast NYC
(A) (B) (C) (D) (A) (B) (C) (D)
Grapes 3,000 2,073 751 2,000 4,253 3,500 1,832 2,500
Apples 400 3,076 2,298 900 27,250 19,000 14,250 9,000
Oranges 6.0 3.1 3.9 5.0 28.4 20.0 13.8 10.0
I have gotten the following formula to work with your data with one minor issue, you will need to fill the header columns (Northeast/NYC) to allow the match to work
=VLOOKUP(A9,A1:I5,MATCH((B9&C9),(A1:I1&A2:I2),0),FALSE)
**NB: Because the formula is using an array function you will need to execute it using the Crl-Shift-Enter command :)
here is a screenshot to let you decipher the references :)
I hope this is helpful