I have the following table:
I only want to count each rows which look like that: K,0,1
I tried
=AND(COUNTIF(A:A;"K");COUNTIF(B:B;0);COUNTIF(C:C;1))
However that only gives me a boolean value back and does not count?
I really appreciate your suggestions!
COUNTIFS extends the usefulness of the COUNTIF function by allowing you to specify from 2 to 127 criteria rather than just one as in COUNTIF.
COUNTIFs(A:A;"K";B:B;0;C:C;1) It should work fine. And solution is already stated by simoco via comment.
Let me know, if it works.
Related
I'm trying to rank the following items based on price using the following formula =SUMPRODUCT(([Item]=[#Item])*([#Price]<[Price]))+1, but it isn't returning any results:
When I use the same formula in the following test table it works, =SUMPRODUCT(($A$2:$A$7=A2)*(B2<$B$2:$B$7))+1:
Can someone please let me know what I am doing wrong? Thanks
EDIT 2 : Evaluation https://imgur.com/a/eXIYPAP
Your formula works fine for me.
Are you sure that A2 and A3 are the same value? There may be some hidden white space causing problems. Just try
=A2=A3
in another cell to make sure they are the same.
USE COUNTIFS INSTEAD
I don't know why your formula isn't working, however, I would suggest avoiding SUMPRODUCT where you can.
=COUNTIFS([Item],[#Item],[Price],">"&[#Price])+1
This will count the number of prices higher than the current one for each item (+1, if you want the rank to start at 1 instead of 0)
If your goal is to get the ranking for each unique item, =SUMPRODUCT(([Item]=[#Item])*([Price]>[#Price]))+1 should do the trick. If the goal is to get the ranking based only on price, don't have it figured out yet.
How to use vlookup function where lookup table array is dynamic? I find the column where I need to lookup values using MATCH function. Can you please suggest how to put integer value coming from MATCH to lookup array function.
I'm not sure if this is all you're asking, but if you're trying to match the column, you can just include the entire range of the spreadsheet. Or you could use an Index function to resize. Lots of options.
To directly answer your question, here's a dynamic vlookup that will include any possible row (as it extends all the way to the bottom of the spreadsheet), and uses Match, to lookup the column header DONKEY. Not very elegant, but it'll get you started. In this case the formula would return 49.
Here's the formula if you want it: =VLOOKUP("California",$I$5:$XFD$1048576,MATCH("Donkey",i4:$XFD$4,0),0)
UPDATE somehow the above answer has gotten two likes so I will make a bigger effort to enhance this answer by explaining that Index Function would probably be a better approach than Vlookup. The formula would look like this: =INDEX(J5:M7,MATCH("Cobra Kia",I5:I7,0),MATCH("Donkey",J4:M4,0),1)
Also, OP tagged VBA although it doesn't seem like this is needed. However if using VBA and trying to do MATCH, always us Application.Match approach, even though it doesn't auto populate like Application.WorksheetFunction.Match. I wrote about that too in this answer... (still not as good as my SHA256!)
I have a bank export of Credit card vendors. As these vary, I use unique strings contained in each to identify them. For example here is a lookup table excerpt.
First Lookup
I then apply a formula =INDEX(First_level,MATCH(TRUE,ISNUMBER(SEARCH(Keywords,C3374)),0)) to produce this:
First calc
I found this formula here https://exceljet.net/formula/get-first-match-cell-contains
Then I reapply the formula to the result ie the First_Level using this formula =INDEX(Second_Level,MATCH(TRUE,ISNUMBER(SEARCH(Frst_Lev_Check,H44)),0)) with this Lookup.
Second Lookup
Most of the time it works, but for this I get the following
Second calc, where the first level classification is correct, but the second level one is completely wrong.
When I've gone into the depths of the formula, the issue is that the Search function is returning the wrong value.
This appears to be a known issue: https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-use-named-range-in-search-function/14c8c989-bed0-48f9-bce0-c0894571b557
Ideas welcome on workarounds/how to solve the problem.
Cheers Jon
Would you consider:
=MATCH("Apple",List)
and
=MATCH("Pear",List)
to return 1 and 2 respectively.
A couple of things in regards to your question:
The correct syntax for search is =SEARCH(find_text,within_text), so the correct formula would be =SEARCH("Pear",List).
The reason why you are getting the #Value is, because you are applying search to a range, but the function is only intended for cells.
The best ways to see if a value exists in a range are the countif and match function:
The countif function shows you how many times the a value is in a range:
The match function shows you in which row the the first value is:
I want to be able to use the COUNTIFS formula for multiple criteria.
For example:
1,Banana
2,Orange
1,Banana
2,Orange
I want to use COUNTIFS to count how many occurrences of 1 is associated with banana and how many times 2 is associated with orange.
I'm thinking of =COUNTIFS(A:A,1,B:B,"Banana")+=COUNTIFS(A:A,2,B:B,"Orange")
This would supposedly equal 4, but I know that formula is wrong and I don't know how to format it.
If this is not possible, then I'd have to use two of the same formulas and add them together, but I'm looking for a better way and just use one formula.
How do I go about this problem, any help would be greatly appreciated.
Thank you.
EDIT: =COUNTIFS(A:A,1,B:B,"Banana",A:A,2,B:B,"Orange") returns 0 for some reason, why is that?
You can try SUMPRODUCT function instead:
=SUMPRODUCT(((B:B="Orange")+(B:B="Banana"))*(A:A=1))
To add additional criteria value, you need to add it to the rest, for example - adding Apples criteria:
=SUMPRODUCT(((B:B="Orange")+(B:B="Banana")+(B:B="Apple"))*(A:A=1))
Similar logic needs to be used to add another criteria range, for example:
=SUMPRODUCT(((B:B="Orange")+(B:B="Banana"))(A:A=1)(C:C="X"))
Hope it helped.
EDIT: Just saw question adjustment. In that case you should use following logic:
=SUMPRODUCT((B:B="Orange")(A:A=1)+(B:B="Banana")(A:A=2))
your formula should be
=COUNTIFS(A:A,1,B:B,"Banana")+COUNTIFS(A:A,2,B:B,"Orange")
I'm currently trying to get the row of a certain value I'm looking for. This works fine but now I want to use that value as the row I need to look in for other data.
At the moment I have this:
=IF(MATCH(A2; Stuklijsten!$A2:$A$65000;0); ""; Stuklijsten!$C$(MATCH(A2,Stuklijsten!$A2:A65000,0)))
But, obviously, that throws an error. I want the second MATCH to just return the row and use that in the IF statement.
So what I'm doing, in words, is: Find this value, if you find it return the value of a certain cell on that row.
Is this possible in a formula? If so, how should I do that?
Thanks in advance.
You can also use Vlookup (http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx)
=VLOOKUP(A2;Stuklijsten!$A2:$C$65000;3;FALSE)
Use:
=Index(Stuklijsten!$C$2:$C$65000; match(A2;Stuklijsten!$A$2:$A$65000;0))
Or
=iferror(Index(Stuklijsten!$C$2:$C$65000; match(A2;Stuklijsten!$A$2:$A$65000;0));"")