I'm trying to arrange a column so that I can essentially "score" results.. I am looking for a formula that will go "If greater than 100000 but less than 110000 = 10, if greater than 90000 but less than 99999 = 9, etc etc.. can someone help?
We can use LOOKUP with ranges:
=LOOKUP(A2,{0,90000,100000,110000,120000},{"0-89999","90000-99999","100000-109999","110000-119999","120000-Inf"})
I used lookup output as ranges to show what lookup is trying to do, in your case use below:
=LOOKUP(A2,{0,90000,100000,110000,120000},{8,9,10,11,12})
You can do this a few ways. Vlookup or summing if statements. Assuming your column you want to score is in column A and you are scoring in column B try these:
Vlookup
(assuming a table is on column c and d)
=VLOOKUP(A1,C1:D2,2)
Ifs
=IF(A1=10000,10,0)+IF(A1=9000,9,0)
Related
Here Table A has values where A,C has duplicate. In Table B , for each of A,B,C which is considered as input to table A , it should fetch 12,33,14. The table b populates the output by checking the occurrence in Table A and getting the most common value . Here in this example A had 11 & 12. But 12 had 3 occurence.so it's value is 12 Table B can have other values like D or can miss EITHER A OR B OR C. is there any Excel function through this i can achive. I know if u put count and the sort based on count it will work. I am looking for 1 line function
something like Vlookup in excel
Assuming no Excel version constraint per tag listed in the question. You can try the following in cell D2:
=LET(A, A2:A8, B, B2:B8, cnts, COUNTIFS(A,A,B,B), ux, UNIQUE(A),
out, MAP(ux, LAMBDA(x, TEXTJOIN(",",,UNIQUE(FILTER(B, (A=x)
* (cnts = MAX(FILTER(cnts, A=x)))))))), HSTACK(ux, out))
The formula considers the scenario where one or more values have the maximum number of occurrences, like in the case of C value, both values 13, and 14 are present in just once. We use TEXTJOIN to collect both values.
Here is the output:
Note: You cannot use inside MAP the MAXIFS function because it is a RACON function and cnts is not a range. We use as a workaround MAX filtering by rows that match A=x. The approach of using: MAX((A=x) * cnts) also works, but under the assumption that all filtered values are not negative.
How can I get the summation of all the cells in column B given the value in column A. Let's say I want to get the summation of all the values in column B for value "1000" in column A.
Is this possible? What I've tried so far is using SUM, INDEX, and MATCH functions but I'm only able to get the first cell data.
SUM(INDEX(A1:B8, MATCH("1000",A1:A8, 0), 2))
Anyone who has some hints for me? Thanks!
One should use SUMIFS (or its cousin SUMIF, which is slightly inferior):
=SUMIFS(B:B, A:A, 1000)
It's pretty simple:
For 1000: =SUMIF(A1:A8, "=1000", B1:B8)
For 2000: =SUMIF(A1:A8, "=2000", B1:B8)
That results in:
82.3
399.39
I have this:
My issue:
in column F2 I want R2 -> IF -> B2+C2+D2 exists in O:O;P:P;Q:Q
but I do not know how to use VLOOKUP with multiple columns
my attemp was '=VLOOKUP(B2;O:O;4;FALSE)' and I do not know why I used 4... cuz I count R2 as index 4 from O2...
This is just a multiple column lookup. While two column lookups are more common, three column lookups are not that rare.
=index(r:r, aggregate(15, 6, row($2:$999)/((o$2:o$999=b2)*(p$2:p$999=c2)*(q$2:q$999=d2)), 1))
That will return the value from column R for the first matching set of columns O:Q. In the case of multiple matches, you could return the last match by changing 15 to 14.
Since your returned results are expected to be numeric, a sumifs could also be used.
=sumifs(r:r, o:o, b2, p:p, c2, q:q, d2)
However this would return skewed results is more than a single match was found.
In your own vlookup, the 4 represents the fourth column of your lookup range. Since you were only providing a single column (e.g. O:O), you would never return the value from column R without changing the lookup range to O:R.
Another approach (since they look like dates DD/MM/YYYY) would be to convert each group of three columns to dates
=INDEX(R:R,MATCH(DATE(D2,C2,B2),INDEX(DATE(Q:Q,P:P,O:O),0),0))
#Jeeped is right to point out that this is slow on full columns, so plz use a formula like
=INDEX(R$1:R$100,MATCH(DATE(D2,C2,B2),INDEX(DATE(Q$1:Q$100,P$1:P$100,O$1:O$100),0),0))
and adjust the ranges to include your data.
If O:O;P:P;Q:Q is unique, you can use:
=lookup(1,0/((O:O=B2)*(P:P=C2)*(Q:Q=D2), R:R)
I'm trying to use an AND operator inside MAX and IF functions and am having trouble. I want to find the maximum value from column C where both are true:
column A = $D$1
the max only considers the top 80% of the values in column B
So in the example below, the answer would be 7, since of the rows with column A = "foo" and the top 80% of column B which are 3,4,5,6 the max value is 7.
I have two components working:
=MAX(IF($A$1:$A$12=$D$1,$C$1:$C$12))
returns 12
=MAX(IF(B1:B12>PERCENTILE(B1:B12,0.2),C1:C12))
returns 8
If I put them together like this it returns 0 (even with ctrl+shift+enter):
=MAX(IF(AND($A$1:$A$12=$D$1,B1:B12>PERCENTILE(B1:B12,0.2)),C1:C12))
The solution with both AND clauses should be 7
Can anyone help with this?
please modify array formula to:
=MAX(IF(A1:A12=$D$1,IF(B1:B12>PERCENTILE(B1:B12,0.2),C1:C12)))
end with ctrl+shift+enter
Multiplying the booleans together did the trick:
=MAX(IF(($A$1:$A$12=$D$1)*(B1:B12>PERCENTILE(B1:B12,0.2)),C1:C12))
I don't know why multiplying works but AND doesn't. God I hate Excel.
I am trying to get the average value(s) of some specific entries. I have two columns: A-which is an index column (it goes e.g. from 1 to 1000) and B which is the values column.
I know there is an AVERAGE function and there is an AVERAGE IF function, which will probably help me but I can't seem to get it working the way I need to.
What I need to do is to get the average value of the entries in column B that match this description for the index in column A: 3 + (3*n) in which n >= 0. In this case I need the average of the values in column B, whose entries in A are 3, 6, 9, 12, 15...
Is it possible to do this with excel or do you think it would be better to write a program to get those values?
Thanks for your tips!!
-Jordi
You can use an "array formula" with AVERAGE function, e.g.
=AVERAGE(IF(MOD(A2:A100,3)=0,IF(A2:A100>0,B2:B100)))
confirmed with CTRL+SHIFT+ENTER
To modify according to your comments in simoco's answer you can use this version
=AVERAGE(IF(MOD(A2:A100-11,3)=0,IF(A2:A100-11>=0,B2:B100)))
That will average for 11, 14, 17, 20 etc.
You can use SUMPRODUCT for this:
=SUMPRODUCT((MOD(A1:A1000,3)=0)*B1:B1000)/MAX(1,SUMPRODUCT(1*(MOD(A1:A1000,3)=0)))
Explanation:
MOD(A1,3) gives you 0 only if value in A1 is in form 3*n
MOD(A1:A1000,3)=0 gives you array of true/false values {FALSE,FALSE,TRUE,FALSE,..}
since False is casts to 0 and TRUE casts to 1 when multipliybg by any value, (MOD(A1:A1000,3)=0)*B1:B1000 returns you array of values in column B where corresponding value in column A is in form 3*n (otherwise zero 0): {0,0,12,0,..}
SUMPRODUCT((MOD(A1:A1000,3)=0)*B1:B1000) gives you a sum of thouse values in column B
SUMPRODUCT(1*(MOD(A1:A1000,3)=0)) gives you number of values in form 3*n in column A
and the last thing: MAX(1,SUMPRODUCT(1*(MOD(A1:A1000,3)=0))) prevent you from #DIV/0! error in case when there is no values in column A in form 3*n
UPD:
in general case, say for rule 11+3*n you could use MOD(A1:A1000-11,3)=0