I am trying to achieve a counta of two string conditions.
There is a database with:
Columns C2:C which contains a string of languages.
Columns F2:F which contains a string of TRUE / FALSE.
C F
German TRUE
German TRUE
German FALSE
German FALSE
French FALSE
French TRUE
French TRUE
etc.
The answer I'm looking for: (IF DASHBOARD!B12 = "German", AND F:F = "TRUE" , then the answer would be 2)
I have already tried:
=COUNTA(IF(AND(C:C=DASHBOARD!B12,F:F="TRUE"),1,0))
//This gives me the answer of 1?
=COUNTA(IFERROR( FILTER( F2:F , SEARCH( "TRUE" , F2:F ) ) ) )
// This gives me the correct answer of 89
=COUNTA(IFERROR( FILTER( C2:C , SEARCH( DASHBOARD!B12 , C2:C ) ) ) )
//This gives me the correct answer of 37
How do you merge the last two expressions so that the counta will ONLY count those where column F = TRUE and column C = DASHBOARD!B12?
I have already tried =SUMPRODUCT() and =ARRAYFORMULA() to no avail, there must be something that is going wrong with such a simple expression...
I would suggest you use true() and false() function instead of string "true", "false". It is better to put in function if().
You can use more condition in filter(),like: filter(C:F,C:C="French",C:C="TRUE")
I have made a example sheetsheet for your reference.
Please check below.
https://docs.google.com/spreadsheet/ccc?key=0AhDkbjKh37REdGloc2NFbDlXeGNrSm1TTHhyVFFWelE
I believe the data in C:D is what you want.
Related
I am creating a Product Decoder for a project.
Lets say, Our product can have a code such as "ABCDE" OR a code like "BCDEF".
ABCDE has a table of data that I use to decode using a lookup. For example AB can decode into "Potato" and CDE can decode into "Chip". So any combination with AB can be Potato "Anything else".
BCDER, BC can decode into "Veggie" so DER can code into "Chip".
I also use the 1/search method to take placements for the decode. Example =IFERROR(LOOKUP(2,1/SEARCH($E$19:$E$23,N18),$E$19:$E$23), "")
I concatenate all the decodes using =S2&" "&T2&" "&U2&" "&V2
Question is...if we are getting a huge amount of product code coming that I want to decode into one single column... How do I tell excel to use this table of data for ABCDE if product starts with "A", if not, use table of data that correlates to BCDER when product starts with "B".
Edit 1:
Here is my table, right side is where i look up the Part Number column N"
As you can see on column "W" I concatenate the date is Look up from columns O~V.
Column O Function: =IFERROR(LOOKUP(2,1/SEARCH($C$1:$C$7,N2),$C$1:$C$7), "")
On column N, I have two parts. One that starts with M and one that starts with K which is pretty standard.
Image two is me trying to use the IF Left but, it doesn't really work
=IF(LEFT(AA4,10) = "M ", W2, W18)
So How can I tell my excel page to use Table A1:A12 if part starts with "M*" and vice versa?
Let me know if this is confusing, I will do my best to clear things up.
First, a possible correction
I think this function does not give you what you say it does:
= IFERROR(LOOKUP(2,1/SEARCH($E$19:$E$23,N18),$E$19:$E$23), "")
You might mean:
= IFERROR( LOOKUP( 2, 1/SEARCH( $E$19:$E$23, N18 ), $F$19:$F$23 ), "" )
Because you want to look up the value in column E and return the value in column F. If that's not true, then skip the rest of this answer.
Now the solution
What you're trying to do is change the lookup array if the part number starts with a different letter. So, the IF( LEFT( combo mentioned by #BigBen should be used to modify the lookup array. I think it would look like this:
= IFERROR( LOOKUP( 2
,1/SEARCH( IF( LEFT( AA4, 1 ) = "M"
,$C$2:$C$12
,$C$19:$C$23 )
,N2 )
,IF( LEFT( AA4, 1 ) = "M"
,$D$2:$D$12
,$D$19:$D$23 )
)
,"")
I want to use COUNTIF in Excel, but I want to count rows where column V = yes OR column U = yes, with all the other criteria the same.
It is easy to use or with values in 1 column, such as P4:P999 = "apple" or "orange", but how to use or over multiple columns?
Below is an Excel code sample written to be readable. The only solution I found was to use addition and rewrite the entire code, but I hate this solution because it is too long.
SUM(COUNTIFS(
P4:P9999, {"apple", "orange"},
B4:B9999, "potato",
AF4:AF9999, "",
V4:V9999, "Yes"
)
) +
SUM(COUNTIFS(
P4:P9999, {"apple", "orange"},
B4:B9999, "potato",
AF4:AF9999, "",
U4:U9999, "Yes"
)
)
Switch to SUMPRODUCT:
=SUMPRODUCT(((P4:P9999 = "apple")+(P4:P9999 = "orange"))*(B4:B999="potato")*(LEN(AF4:AF999)=0)*((V4:V9999="Yes)+(U4:U9999="Yes")>0))
I have 3 conditions based on this table: https://i.stack.imgur.com/GAeT0.png
Conditions are:
In column "Stadiu" (starting from D5) should type:
RIDICATA if the number from Populatie is > 1000 and the column Eveniment has Mondiala in it
MEDIE if the number from Populatie is > 500 or <= 1000 and the column Eveniment has Mondiala
MEDIE if the number from Populatie is > 500 and the column Eveniment has Internationala
SLABA = rest
I tried this formula:
=IF(AND(C5>1000;FIND("Mondiala";A5));"ridicata";IF(AND(C5>500;C5<=1000;FIND("Mondiala";A5));"medie";IF(AND(C5>500;FIND("Internationala";A5));"medie";IF(AND(C5<500);"slaba"))))
but it doesn't work.
I am new to Excel, so I hope you guys can help me what I am doing wrong. Thanks!
When evaluating the formula, anywhere that the FIND function doesn't find the string you're searching for, it returns a #VALUE error instead of 0 or FALSE. That's causing the whole formula to fail in those circumstances, so you need to handle those cases with IFERROR.
In addition, your nesting wasn't quite correct. You did not have an ELSE result for cases where all three tests failed. The following formula should return the expected results based on your criteria provided:
=IF(AND(C5>1000;IFERROR(FIND("Mondiala";A5);0));"Ridicata";IF(OR(AND(C5>500;C5<=1000;IFERROR(FIND("Mondiala";A5);0));AND(C5>500;IFERROR(FIND("Internationala";A5);0)));"Medie";"Slaba"))
Might be a little easier to relate it to your test criteria by spreading it out into sections:
=IF(
AND(
C5>1000;
IFERROR(FIND("Mondiala";A5);0)
);
"Ridicata";
IF(
OR(
AND(
C5>500;
C5<=1000;
IFERROR(FIND("Mondiala";A5);0)
);
AND(
C5>500;
IFERROR(FIND("Internationala";A5);0)
)
);
"Medie";
"Slaba"
)
)
In Excel 2010, I have set up a two dimensional table that is filled with percent errors. These percentages are calculated based on a user input, so the values change depending on what value the user asks for.
What I would like to do is be able to find the location of the cell in the table that is closest to zero, and return the row and column of that data point for further calculations. Is there a way to do this without using a macro?
Thanks in advance for any help.
EDIT: The percent errors are non-negative, and may appear more than once in the table.
That would be too unreliable for cells with the same absolute value closest to 0 (for example -1 and 1).
This array formula will get the absolute value closest to 0:
{ = MIN( ABS( Table1 ) ) }
Where Table1 is the name of the table or range. If the table has values -1 and 1, then it will return 1.
Then those array formulas to get the max row and max column of the values closest to 0
{ = MAX( ROW(Table1) * (ABS(Table1) = MIN(ABS(Table1))) ) }
{ = MAX( COLUMN(Table1) * (ABS(Table1) = MIN(ABS(Table1))) ) }
Update
This array formula should work for your mirrored data:
{ = ADDRESS( MIN( IF( ABS(Table1) = MIN(ABS(Table1)), ROW(Table1) ) ),
MAX( IF( ABS(Table1) = MIN(ABS(Table1)), COLUMN(Table1) ) ) ) }
You can remove the ABS parts if there are no negative values:
{ = ADDRESS( MIN( IF(Table1 = MIN(Table1), ROW(Table1) ) ),
MAX( IF(Table1 = MIN(Table1), COLUMN(Table1) ) ) ) }
The trick is that Min and Max ignore logical values, so I omitted the third parameter of the If
Update 2
This array formula is a bit simplified version of #JohnBustos 's answer (I am still not sure why he uses SMALL instead of MIN):
{ = MIN( IF(Table1=MIN(Table1), ROW(Table1)*1000 +COLUMN(Table1)) ) }
This will return number like 3005 where 3 is the row and 5 is the column, so the address is:
{ = ADDRESS( MIN( IF(Table1=MIN(Table1), ROW(Table1)) ),
MOD(MIN( IF(Table1=MIN(Table1), ROW(Table1)*10^5 +COLUMN(Table1)) ), 10^5) ) }
The VBA version will be much simpler, because of the Range.Find method:
Function findMin(r As Range) As Range
Set findMin = r.Find(WorksheetFunction.Min(r))
End Function
with sample uses:
=CELL("address", findMin(Table1))
=ROW(findMin(Table1))
=COLUMN(findMin(Table1))
I'm curious to see how others do this, but, for the sake of example, suppose your data was set up in the range A1:G7. You could do this via the following array function (meaning press CTRL+SHIFT+ENTER after entering the formula) as follows:
=ADDRESS(MIN(IF(ABS(A1:G7)=SMALL(ABS(A1:G7),1),ROW(A1:G7)),MIN(IF(ABS(A1:G7)=SMALL(ABS(A1:G7),1),COLUMN(A1:G7))))
Note that if you wanted the row and column values separately, they are in this formula too:
Row: = MIN(IF(ABS(A1:G7)=SMALL(ABS(A1:G7),1),ROW(A1:G7)))
Col: = MIN(IF(ABS(A1:G7)=SMALL(ABS(A1:G7),1),COLUMN(A1:G7)))
Hope this helps.
UPDATE:
Given the comment made (which I completely missed) that if the value appeared more than once you could get a different result for the row and column values, I made up a new formula that will give you the result you want.
Give this a try:
=CELL("address",INDIRECT(TEXT(SMALL(IF(ABS(B2:GS201)=SMALL(ABS(B2:GS201),1),ROW(B2:GS201)*10^4+COLUMN(B2:GS201)),1), "R0000C0000"),0))
I am trying to write a formula to include multiple criteria and can't seem to get it right.
The formula works as is however I need to include "SHOT10","SHOT20", "SH15" and "SH20"
=IF(AND(C5194="SHOT15",H5194="",I5194=""),E5194,"")
Can someone assist me with modifying the above formula?
The AND(C5194="SHOT15",H5194="",I5194="") is equivalent to saying:
C5194="SHOT15" And H5194="" And 15194=""
So what you have in VBA code is:
If C5194="SHOT15" And H5194="" And 15194="" Then
ActiveCell = E5194
Else
ActiveCell = ""
End
You can use AND( and OR( to specify different parameters.
For example, If I want to pickup 3 different values in 'A1', but make sure that 'B1' and 'C1' are blank, I can use:
=IF(AND(OR(A1="A",A1="B",A1="C"),B1="",C1=""),"True","False")
So in your case specifically:
The issue now is that I now need to also consider SHOT10, SHOT20, SH15 and SH20 as well. Meaning that if either SHOT15, SHOT10, SHOT20, SH15 or SH20 appears in C5194 and H5194 is blank and I5194 is also blank then return the value of E5194 else return blank. The key is that all the conditions must be met for the value of E5194 be returned
Your formula becomes:
=IF(AND(OR(C5194="SHOT15",C5194="SHOT10",C5194="SHOT20",C5194="SH15",C5194="SH20"),H5194="",I5194=""),E5194,"")
Edit: Shorten Using an array constant per barry houdini:
=IF(AND(OR(C5194={"SHOT15","SHOT10","SHOT20","SH15","SH20"}),H5194="",I5194=""),E5194,"")
=IF(
AND(
OR( C5194="SHOT10", C5194="SHOT15", C5194="SHOT20", C5194="SH15", C5194="SH20" ),
H5194="",
I5194=""
),
E5194,
""
)