Multiple COUNTIFS, with variabel text and numbers and named ranges - excel-formula

I'm after a way to combine these 2 COUNTIFS formulas. They both work independently but I can't seem to find a way to join them. I want it to say "Price Not Ready" when any of the total criteria for either formula aren't met. So if the criteria of one formula is TRUE then display text. If either of them aren't TRUE then display "Price Not Ready".
The text "short" and "long" are named ranges.
=IF(COUNTIF(Long,""&D8&""),If(countifs($E$5>1,$F$5>1),"Bullish","Price Not Ready"))
=IF(COUNTIF(Short,""&D8&""),If(countifs($E$5>1,$F$5>1),"Bearish","Price Not Ready"))
Any help would be appreciated thanks.

You can make things easier by using AND to combine criteria. The result will be TRUE if all arguments joined via AND are TRUE. One possible solution would then be:
=IF(AND(COUNTIF(Long,""&D8&""),If(countifs($E$5>1,$F$5>1))),"Bullish",AND(IF(COUNTIF(Short,""&D8&""),If(countifs($E$5>1,$F$5>1)))),"Bearish","Price Not Ready")
Please let me know if this works for you. If not I might need some more background on the initial arguments e.g. COUNTIF(Long,""&D8&"")
I would be expect the result to be either TRUE or FALSE or numerically either 1 or 0 in order to work as first argument in an IF formula which is supposed to be a logical test / result.

Related

In Excel which formula can write that would easily identify if my output condition is true or false

I am trying to do an excel formula calculated response in regards to comparing the values of three cells.
I have three cells and if one or more cell is populated with a value of greater than "0" I want it to return mix and if false ignore
Yes, actually you're correct you'll need to use COUNTIF or IF. The function IF should be good enough depending on your formula.
Please try to use the formula how I had in illustrated in my image. =IF(D3>TODAY(),"YES","NO"), your formula would be different depending on your values or if you're using dates.
If you're not using dates you can still just use IF plus the AND functions like this "=IF(AND(B3,C3,D3)<="","TRUE","FALSE")", see my linked file to see how I did it. Good luck!
Tip, you can check for "0"(a number) or ""(which means blank).
Check Value in 3 Cells for TRUE-FALSE example in excel.
Screenshot that might help understand how I use '=IF(AND...' Functions to do just what you originally asked.
To answer the revision to your question I would recommend referencing Microsofts resource on CONCAT function Combine text and numbers
Conversely, I've worked out an example for you. =IF(E4>0,(CONCAT("YES: B4:D4 ="," ",(TEXT(C4,"MM/DD/YY"))," + ",(TEXT(D4,"MM/DD/YY"))," + ",D4," Total Days")),"NO") which references my example screen shot here:
The use of "IF" plus the "CONCAT" function to return the mix of three or more cell values.

Nested Excel Formula Modification Question

I am trying to figure out whats wrong with a nested formula I created:
In the image you can see the three sections the formula is broken up into:
is grouping cells into buckets
is referencing a separate tab (city density scores) and selecting only if the value is less than or equal the value in that tab
is performing a lookup also referencing a separate tab, and pulling in that value as long as that condition is met.
There is a unique key linking all three tabs. If all three conditions/sections of the formula are met, the idea is to return the value "Select" and if not, "Don't Select."
When I ran this formula in excel I'm getting "Don't Select" for cells that meet all #1,#2,#3 criteria, trying to figure out what I am doing wrong.
This is the formula I created. I feel its a small change that I need to make:
=IF(AND(OR(AM6="1 to 3 Bucket",AM6="4 to 7 Bucket"),$BK6<='City Density Scores'!$H$6), IF((VLOOKUP(BI,'Rank Competition Vetting'!$A$7:$F$182,5,0))<33%,"Select","Don't Select"))
Your formula logic is a little off. The correct form is (replace BI6 with whatever the correct cell is)
=IF(AND(OR(AM6="1 to 3 Bucket", AM6="4 to 7 Bucket"), $BK6<='City Density Scores'!$H$6, VLOOKUP(BI6, 'Rank Competition Vetting'!$A$7:$F$182,5,0) < 33%), "Select", "Don't Select")
Lets break it down: you have 3 criteria, all of which must be true to return Select
You have
IF(AND(OR(#1a,#1b),#2), IF((#3,"Select","Don't Select"))
This will work if #1 and #2 are TRUE, and fail otherwise (returns FALSE) because you havn't specified a False clause for the outer IF.
You really want all 3 clauses in the AND term
IF(AND(OR(#1a,#1b),#2,#3),"Select","Don't Select")
Now, you say you still get a false negative for a case where you believe all 3 criteria are met. To me, this points to a data issue - perhaps some numbers formatted as text? In any case, using the Evaluate Formula tool will help. You say you are having trouble using it: the process is to
select a cell containing the formula, then activate the tool
press Evaluate button repeatedly
at each click the underlined part of the formula is evaluated.
read the Evaluation to see if it lines up with your expectation
Here's an example (of my formula) evaluated up to the point where the VLOOKUP is about to be processed

Searching for multiple words and using IF/OR/Vlookup function

I'm trying to create a formula that will search a cell for the following words.. "Other" & "Repair" if either of these words are found I want it to be categorized as the word that is found. If none of these words are found I want the formula to Vlookup another column to then categorize it.
I got the formula to work for one search word, I cant figure out how to do it with two search words.
below is the formula I used for one word search criteria.
=IF(ISNUMBER(SEARCH("REPAIR",B9089)),"REPAIR",VLOOKUP(E9089,Key!$D:$E,2,0))
This is what I tried doing for the two search words but it breaks at the end for the true / flase statement
=IF(OR(ISNUMBER(SEARCH("REPAIR",B9090)),ISNUMBER(SEARCH("OTHER",B9090))),"REPAIR""OTHER",VLOOKUP(E9090,Key!$D:$E,2,0))
If you need to search for two values and the values returned, an OR statement will not work. Since it will only return true or false to an IF statement, and the IF will then return only one value. Instead, you can nest two IF statements inside each other for each of the values you need to find. Try the following formula:
=IF(ISNUMBER(SEARCH("Repair",B9089)),"Repair",IF(ISNUMBER(SEARCH("Other",B9089)),"Other",VLOOKUP(E9089,Key!$D:$E,2,0)))
(I am assuming your references and the Vlookup statement are correctly written by yourself)
I think you'll need nested IF statements, like this:
=IF(ISNUMBER(SEARCH("REPAIR",B9089)),"REPAIR", IF(ISNUMBER(SEARCH("OTHER",B9089)),"OTHER",VLOOKUP(E9089,Key!$D:$E,2,0))
What this does is first check if "REPAIR" is part of the speciified cell's value, if it isn't it checks if the cell value contains "OTHER", and if that is not the case it performs the desired VLOOKUP.
Please not that this is doable for two conditions, but if it starts getting to higher numbers you should consider writing a custom function in VBA.

Excel Formula for Duplicates

I'm attempting to code a clever duplicate excel formula, but can't seem to determine how. I have a large list of numbers (172,250 to be exact). I need to find which are duplicates and which are not. I have tried COUNTIF, COUNTIFS, and SUMPRODUCT, but all behave very slowly, so much so that it is a hindrance more than a help. What I need is a way to determine a duplicate that will stop after the second is found. I don't need a full count. I'm trying to avoid using VBA as this will eventually be given to an end user, who would be better suited to just copy-pasting the formula into her cells. Any help would be appreciated.
Thanks in advance!
Since you can sort, you can use a simple = comparator.
Let's say your numbers are from A2:A172251 and sorted (leaving one row above for filtering). In B2, put:
=A2=A1
And drag down. You will get TRUE for duplicates and FALSE for the first occurrence of a number. So if you have the following first column, you get the following second column:
Numbers Duplicates
1 FALSE
2 FALSE
2 TRUE
2 TRUE
3 FALSE
4 FALSE
If you don't want to sort, and want to return something for EACH duplicate, no matter where in the list, you could do something like:
A1: =ISNUMBER(MATCH($A1,$A2:$A$10000,0))
A2: =OR(ISNUMBER(MATCH($A2,$A3:$A$10000,0)),ISNUMBER(MATCH($A2,$A$1:A1,0)))
Select A2 and fill down as far as needed. Will return TRUE or FALSE depending on if there are duplicates.

Using SUMIFS with multiple AND OR conditions

I would like to create a succinct Excel formula that SUMS a column based on a set of AND conditions, plus a set of OR conditions.
My Excel table contains the following data and I used defined names for the columns.
Quote_Value (Worksheet!$A:$A) holds an accounting value.
Days_To_Close (Worksheet!$B:$B) contains a formula that results in a number.
Salesman (Worksheet!$C:$C) contains text and is a name.
Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.
I want to SUM Quote_Value if Salesman equals JBloggs and Days_To_Close is equal to or less than 90 and Quote_Month is equal to one of the following (Oct-13, Nov-13, or Dec-13).
At the moment, I've got this to work but it includes a lot of repetition, which I don't think I need.
=SUM(SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Oct-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Nov-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Dec-13"))
What I'd like to do is something more like the following but I can't work out the correct syntax:
=SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,OR(Quote_Month="Oct-13",Quote_Month="Nov-13",Quote_Month="Dec-13"))
That formula doesn't error, it just returns a 0 value. Yet if I manually examine the data, that's not correct. I even tried using TRIM(Quote_Month) to make sure that spaces hadn't crept into the data but the fact that my extended SUM formula works indicates that the data is OK and that it's a syntax issue. Can anybody steer me in the right direction?
You can use SUMIFS like this
=SUM(SUMIFS(Quote_Value,Salesman,"JBloggs",Days_To_Close,"<=90",Quote_Month,{"Oct-13","Nov-13","Dec-13"}))
The SUMIFS function will return an "array" of 3 values (one total each for "Oct-13", "Nov-13" and "Dec-13"), so you need SUM to sum that array and give you the final result.
Be careful with this syntax, you can only have at most two criteria within the formula with "OR" conditions...and if there are two then in one you must separate the criteria with commas, in the other with semi-colons.
If you need more you might use SUMPRODUCT with MATCH, e.g. in your case
=SUMPRODUCT(Quote_Value,(Salesman="JBloggs")*(Days_To_Close<=90)*ISNUMBER(MATCH(Quote_Month,{"Oct-13","Nov-13","Dec-13"},0)))
In that version you can add any number of "OR" criteria using ISNUMBER/MATCH
You can use DSUM, which will be more flexible. Like if you want to change the name of Salesman or the Quote Month, you need not change the formula, but only some criteria cells. Please see the link below for details...Even the criteria can be formula to copied from other sheets
http://office.microsoft.com/en-us/excel-help/dsum-function-HP010342460.aspx?CTT=1
You might consider referencing the actual date/time in the source column for Quote_Month, then you could transform your OR into a couple of ANDs, something like (assuing the date's in something I've chosen to call Quote_Date)
=SUMIFS(Quote_Value,"<=90",Quote_Date,">="&DATE(2013,11,1),Quote_Date,"<="&DATE(2013,12,31),Salesman,"=JBloggs",Days_To_Close)
(I moved the interesting conditions to the front).
This approach works here because that "OR" condition is actually specifying a date range - it might not work in other cases.
Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.
You can use OR by adding + in Sumproduct. See this
=SUMPRODUCT((Quote_Value)*(Salesman="JBloggs")*(Days_To_Close<=90)*((Quote_Month="Cond1")+(Quote_Month="Cond2")+(Quote_Month="Cond3")))
ScreenShot
Speed
SUMPRODUCT is faster than SUM arrays, i.e. having {} arrays in the SUM function. SUMIFS is 30% faster than SUMPRODUCT.
{SUM(SUMIFS({}))} vs SUMPRODUCT(SUMIFS({})) both works fine, but SUMPRODUCT feels a bit easier to write without the CTRL-SHIFT-ENTER to create the {}.
Preference
I personally prefer writing SUMPRODUCT(--(ISNUMBER(MATCH(...)))) over SUMPRODUCT(SUMIFS({})) for multiple criteria.
However, if you have a drop-down menu where you want to select specific characteristics or all, SUMPRODUCT(SUMIFS()), is the only way to go. (as for selecting "all", the value should enter in "<>" + "Whatever word you want as long as it's not part of the specific characteristics".
In order to get the formula to work place the cursor inside the formula and press ctr+shift+enter and then it will work!
With the following, it is easy to link the Cell address...
=SUM(SUMIFS(FAGLL03!$I$4:$I$1048576,FAGLL03!$A$4:$A$1048576,">="&INDIRECT("A"&ROW()),FAGLL03!$A$4:$A$1048576,"<="&INDIRECT("B"&ROW()),FAGLL03!$Q$4:$Q$1048576,E$2))
Can use address / substitute / Column functions as required to use Cell addresses in full DYNAMIC.

Resources