I have a COUNTIF query where the formula checks columns for specific text. If any one of these columns contain Missing, then the value returned should be NMC InCorrect, but for some reason the formula is not picking up on this.
Sample data:
TASK Dates TASK Start but No End TASK Notes Lock WI Notes Lock NMC Correct?
TASK Dates Missing Missing Missing NMC CORRECT
TASK Dates Missing Missing Missing NMC CORRECT
Missing Missing Missing Locked by NMC NMCINCORRECT
Missing Missing Missing Locked by NMC NMCINCORRECT
Here is my current formula:
=IF(COUNTIF(M2:P2,"Missing")=4,"NMC INCORRECT","NMC CORRECT")`
As stated above, it should return NMC INCORRECT for line 2 above, because that line has TASK Dates and not Missing in its 1st column.
I think what you want may be:
=IF(COUNTIF(M2:P2,"Missing")>0,"NMC INCORRECT","NMC CORRECT")
Rather than test for a count of 4 Missing in the same row it tests for any number of Missing in that row (any quantity more than none at all).
Related
What I want is if Location and Case Number line up on Sheet1 and Sheet2, add in the Attorney information from Sheet2 to Sheet1. Here's a sample of the kind of data I'm dealing with:
Sample Data
We have repeated case numbers in multiple locations, so the data needs to match case number and location before inputting attorney names.
I stupidly deleted my previous attempts before thinking to ask for help, but I got pretty much every error in the book (#spill, #N/A, #ERROR, etc) I kept getting errors for VLOOKUP, and then I tried IFS, and still can't get anything to work.
My most recent attempt is:
Attempt
=IFS((A:A=Attorneys!A:A)AND(Sheet1!B:B=Attorneys!B:B), Attorneys!F:F)
Which resulted in #SPILL!
Then:
Adjusted Attempt
=#IFS((#A:A=#Attorneys!A:A)*AND(#Sheet1!B:B=#Attorneys!B:B),Attorneys!F:F)
Which resulted in most #N/A, but some random rows populated with one attorney's name, but none of the others.
I've done something similar before, but I was only trying to verify one column of data, not two, and that seems to be breaking my brain. I know I'm missing something really simple in here, but I just can't see it.
Edit:
I also tried Index because I forgot about that one, but I'm 99% sure I did it very incorrectly.
=INDEX(Attorneys!F:F,MATCH(A1&B1,Attorneys!A:A&Attorneys!B:B, 0))
And I got #N/A with no helpful information on the calculation error. This is the error I got: Index Error
Edit 2: I had a stray comma which was causing the error on the Index! I still have some random entries where it's #N/A instead of a name, and I need to check to verify that the data is populating correctly instead of just putting in a random name.
Final edit:
Index without typos did it!
=INDEX(Sheet2!F:F,MATCH(A2&B2,Sheet2!A:A&Sheet2!B:B,0))
Try index/match like:
=INDEX($C$2:$C$4,MATCH(A7,IF($B$2:$B$4=B7,$A$2:$A$4),0))
Thanks to u/findwindow, this is solved!
=INDEX(Sheet2!F:F,MATCH(A2&B2,Sheet2!A:A&Sheet2!B:B,0))
In my case, Sheet2 is called Attorneys, and I have headers so I skipped all of row 1.
I have a table with a list of tasks in it. Each task can have blockers, which are other tasks in the same list, which must be completed before another can proceed. I have mocked up the table below:
So in the example, the Blocker1, Blocker2... etc columns all have data validation to only allow values taken from the Task column. The Done? column can contain "Yes" or "No". The BlockCount column is meant to count the non-Done Tasks that block each task - that's where the problem is.
I would like to count how many of the blockers have been completed for each task by looking up the value in the Done column for each task that is listed as a blocker.
My best effort so far is this formula:
{=SUM(IF(INDEX([Done?],MATCH(Task[#[Blockers1]:[Blockers5]],[Title],0))="No",1,0))}
I confirmed the formula with Ctrl+Enter, trying to get the Index to work for each of the blockers, but this does not work. If I only take the MATCH() part of the formula, I successfully evaluate a range (shown below), but when I try to use that range to index different rows in the Done? column, it seems to only evaluate once, so I am confused what to do.
Can you help with a formula that will count the blockers in this way? I'm trying to list everything I need to do to fix up my house, and frankly this has started to become an time-consuming obsession that I so far have no prospect of solving!
Try SUMPRODUCT:
=SUMPRODUCT(([Done]="No")*MMULT(--([Task]=Table2[#[Block1]:[Block5]]),ROW($A$1:$A$5)^0))
You could approach this with COUNTIF:
=SUM(COUNTIF(Table1[#[blocker1]:[blocker5]],[task])*([done?]="no"))
If the current row [blocker1:blocker5] mention a task that appears in [task] it returns 1(TRUE), else 0 (FALSE) for each value in the range (array).
Multiplying this array against the array of 1's and 0's returns (1*1=) 1 for each row where the task is found and [done?] says no. All others return 1*0, 0*1, or 0*0 all resulting in 0.
SUM adds up the instances of blocker tasks found that mention no.
Older Excel versions need this formula entered with ctrl+shift+enter
I'm making a summary of a list of tasks, and the corresponding dates (start date, first answer date, ...).
It looks more or less like the following:
Title Start date First answer
Task1 29/06/2018 02/07/2018
Task2 09/05/2018
Task3 13/06/2018 14/06/2018
I would like to calculate the average time, needed for the first answer to be given. In case no first answer is given yet, this entry needs to be ignored in the calculation of the average.
In order to be able to understand the formulas better, I've decided to use names for the headers, like:
Name "Header_Title" has value "Title"
Name "Header_Start_Date" has value "Start Date"
Name "Header_First_Answer" has value "First answer"
Also, the number of entries, defined as COUNTA(OFFSET(Header_Title;1;0):A1048576) has a name: Total_Count.
Next to that, I've created names for the ranges of the column values:
"All_Start_Dates" is defined as =OFFSET(Header_Start_Date;1;0):OFFSET(Header_Start_Date;Total_Count;0)
"All_First_Answered" is defined as =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0)
Explanation : take the first entry under the header (column title) and go to the row, corresponding to the last task.
This makes it very easy to write a formula for calculating the average difference between those date columns:
{=AVERAGE(All_First_Answered_Dates-All_Start_Dates)}
// mind the {} for showing this is an array formula
Now the problem is: how to use the AverageIf worksheet function in order not to take into account the cases where First answer is not filled in?
I already tried using ">0" and ">"&0, but this does not work, the formulas are said not to be valid:
{=AVERAGEIF(All_First_Answered_Dates-All_Start_Dates;">0")}
{=AVERAGEIF(All_First_Answered_Dates-All_Start_Dates;">"&0)}
Does anybody have an idea?
Thanks in advance
P.s.1. As you can see, I'm using cell range A1048576 as the last entry of column A, does anybody know a more elegant way to describe this?
P.s.2. One extra thing, which would make my life easier, is the possibility to see which cells have a name (I was thinking about conditional formatting, but I didn't find the way to do this). Does anybody know if there is a way to highlight individual cells, linked to a name?
So my suggested answer would be
=AVERAGEIF(All_First_Answered,">0")-AVERAGEIF(All_First_Answered,">0",All_Start_Dates)
I'm assuming here that all start dates are present but first answered dates may be missing: you could easily add an extra condition for start date if you used AVERAGEIFS. Both parts of the formula include the same conditions so they are working on the same rows.
The intermediate columns above are just included by way of explanation.
Try an array formula.
If you're not familiar with array formulas, the significant difference is you press and hold Ctrl+Shift then hit Enter instead of just pressing Enter. You will see the formula preceded and followed by curly brackets. Do not type those. Those will appear automatically.
=AVERAGE(IF(INDIRECT("C14:C"&LOOKUP(2,1/(A:A<>""),ROW(A:A)))=0,"",INDIRECT("C14:C"&LOOKUP(2,1/(A:A<>""),ROW(A:A)))-INDIRECT("B14:B"&LOOKUP(2,1/(A:A<>""),ROW(A:A)))))
I am trying to write a formula that checks the status and name to be ongoing and joe blogs (in this example), and once finding a match, will identify the oldest date of a ticket raised.
My formula currently includes:
=MIN(IF('Sheet2'!AA:AA="ONGOING",IF('Sheet2'!Q:Q="Joe Bloggs",'Sheet2'!B18:B49)))
I also tried:
=IF((AND(sheet2!$AA:$AA="ongoing", 'Sheet2'!$Q:$Q="Joe Bloggs")), MIN('Sheet2'!B18:B49),"No")
In Column B contains dates. Q contains names, AA contains the status.
At the moment when this runs I get the result '00/01/1990'.
I have done some checks to find the error, and appears to be around the targets name, as when the second formula is tried, the output is "no". The name is definitely in the Q column, and I have completed other formulas including countifs which have worked perfectly fine.
I have done a lot of searching to find nested ifs and min statements to have no joy , would be grateful of any advice / tips. It may be a simple error to some.
Try entering this as an array formula:
=MIN(IF(sheet2!AA:AA="ongoing",IF(sheet2!q:q="Joe Bloggs",sheet2!B:B)))
FYI I found the solution here.
You will have to apply a date format to the result.
Your first formula works well on my data (as below). If I close the formula with ENTER only, I get the result '37128' and if I close the formula with CTRL+SHIFT+ENTER I get the expected result, '25/08/2001'.
Edit: As #FocusWiz said in the comments, the only major difference (other than different column names) between my formula and yours is the the last range in your formula (B18:B49) is a different sized range to the other two, which are referring to full columns.
*This could be solved either by using the same row range for all three column references (AA18:AA49, Q18:Q49, B18:B49) or referencing the full column range for all three ranges (AA:AA,Q:Q,B:B).
This is your formula I'm talking about:
=MIN(IF('Sheet2'!AA:AA="ONGOING",IF('Sheet2'!Q:Q="Joe Bloggs",'Sheet2'!B18:B49)))
And this is the formula in my workbook F7:
=MIN(IF(B:B="ONGOING",IF(A:A="Joe Bloggs",C:C)))
As you can see in the formula editor, squiggly brackets '{}' show around the formula when it has been closed as an array formula.
If that doesn't work for you, please post some sample data with datatypes so we can help figure out what is causing the lookup value to miss the data.
While I like the technique offered by Patrick (I have frequently forgotten an "else" portion of a formula and gotten "false" as a value in a cell but never thought of a use for that...thank you!), I think this question highlights an issue we all can have with array formulas. As girlvsdata indicates, your original formula:
=MIN(IF(Sheet2!AA:AA="ONGOING",IF(Sheet2!Q:Q="Joe Bloggs",Sheet2!B:B)))
(modified above to be more generic for column B) will also work when entered as an array formula.
What likely happened is that somehow the formula got edited and was not re-entered as an array formula.
While I do not dislike array formulas, I do try to avoid them because I have fat fingers and will frequently mess them up by accidentally hitting the wrong key as I am modifying other cells.
Here is an alternative without using an array formula:
=INDEX(LARGE((Sheet2!Q:Q&Sheet2!AA:AA="Joe bloggs"&"ongoing")*(Sheet2!B:B),COUNTIFS(Sheet2!Q:Q,"Joe Bloggs",Sheet2!AA:AA,"ongoing")),1)
What it does is basically create a candidate date value for every row that has "joe bloggs" and "ongoing" which is equal to the date in column B for all such rows. All other rows get a zero candidate date value. The LARGE function takes the smallest nonzero date by counting the n valid candidates with the COUNTIFS function and taking the nth largest such candidate.
I have 2 columns in a spreadsheet. One column has around 26 extra rows than the other. I've been trying various formulas to highlight or somehow indicate which columns are missing from the smaller of the lists...
I tried filling a 3rd colum with this :
=FIND(B1,A1:A1102)
which I though returned 1 if b1 was in the list a1:a1102 alas it doesn't seem to be true.
Anybody got any solutions for comparing 2 lists and isolating differences?
Thanks
To use MATCH, go with something like the following:
=IFERROR(MATCH(B1,$A$1:$A$1102,0),0)
entered into cell C1 and copied down to the end of the data in column B
This assumes that column B contains the longer list and A the shorter, of course.
The MATCH formula will return the row in which B1 is matched in A.
You can use a combination of if, iferror and vlookup functions.
=IF(IFERROR(VLOOKUP(B1,$A$1:$A$10,1,FALSE),"missing")="missing", 1, 0)
This will find matches in column A for the values in column B. If the value is missing, the iferror will report it missing (#N/A). Then the if function will output a 1 for the missing values and a 0 for those found.
EDITED:
My bad, I suggested the wrong function - except the absolute reference, you need to use MATCH - as suggested in other answers: =MATCH(B1,$A$1:$A$1102,0) or look up the whole column: =MATCH(B1,A:A,0).
Missing items will be returned as #N/A, but it easily handled with IFERROR.
I know this is a bit old, but I could not get MATCH() to work across different tabs in the same workbook. Also, I'd rather not add columns if I don't have to. What worked for me, was to use conditional formatting:
Select one column that you want to test (assume it's 'Z' for this example)
Select Conditional Formatting -> New Rule
Select 'Use a formula ...'
Use =COUNTIF('otherTab'!$A:$A, $Z1) - where 'otherTab' is the name of the other tab, 'A' is the column in that tab you want to test against and 'Z' is the column in THIS tab
Set the color scheme that something that says "I found a match!" to you
Click OK
Then you can do the same on the other column if you need to check both.
I think you need to use MATCH instead of FIND
Or if you want to be fancier about it, check out this thread:
https://superuser.com/questions/289650/how-to-compare-two-columns-and-find-differences-in-excel