I need to count the amount of times a value shows up in the B column and display it in 3 seperate fields. What I came up with was this piece of code:
=COUNTIF(B2:B6716,"0")
=COUNTIF(B2:B6716,"1")
=COUNTIF(B2:B6716,"2")
But no matter how I enter this It keeps telling me the formula is incorrect. I tried removing the " around the three numbers aswell btw and even in order to test it I even used some words but it just won't work. Any idea how I can get this to work?
The error:
Try something like:
=COUNTIF(B1:B416; "=0")
As a criteria, you should rather put some string that appended to tested value forms a condition, not a particular number. This way, you can formulate more fancy criteria, like:
=COUNTIF(B1:B416; ">100")
Related
I'm building a monitoring system that takes a log (where people register their work in a set format) and returns a counter, which I can use for analysis. The monitor and log are two separate workbooks. The log has entries like this: INITALS;DATE;HOUR:RESULT|
Each cell can contain multiple entries.
My first attempt was to do a simple countif and look for a string (note that I use ; instead of , in formulas since I work on a Dutch excel):
=COUNTIF('LOCATION'!Table[LOG];"*NB;??/??/????;??:??:#A*|*")
This worked fine, but the formula only counted the number of cells where this string was present, not the actual number of occurences. I then tried this solution.
=SUM(LEN('LOCATION'!Tabel13[LOG])-LEN(SUBSTITUTE('LOCATION'!Tabel13[LOG];"NB";"")))
This indeed counted the number of times "NB" was present in the LOG. However, when I tried to use the original search string, this solution stopped working:
=SUM(LEN('LOCATION'!Tabel13[LOG])-LEN(SUBSTITUTE('LOCATION'!Tabel13[LOG];"*NB;??/??/????;??:??:#A*|*";"")))
It seems to me that SUM does not recognize symbols like ? or * which are necessary to define the correct search string. Where did I go wrong? Or can this be solved in another way? I can still look into VBA, but the workbooks are slow as hell already.
"?" and "*" are wildcards. Some functions support these (like COUNTIFS()) where others don't. Like you found out, SUBSTITUTE() does not.
Here is one way to count, assuming ms365:
Formula in C1:
=REDUCE(0,A1:A2,LAMBDA(a,b,a+LET(X,SEQUENCE(LEN(b)),SUM(--(IFERROR(SEARCH("NB;??/??/????;??:??:#A*|*",b,X),0)=X)))))
Note: I removed the asterisk in front of "NB" just to make searching for a position valid in comparison to what i called variable "X".
I have an planning exported to Excel which looks like the following (tab ' Data'):
Each production line has a number of people working on it. Now is my goal to show how many people are working on a line per minute. We plan per product group, and several product groups combined form waht a line has to do per minute.
To get the production per minute I created the following (tab 'Conversie'):
=INDEX(Data!$H$2:$H$157;MATCH($N$1&A4;Data!$B$2:$B$157&Data!$C$2:$C$157;1))
In the example it works correct. However, the formula doesn't seem to always return the correct "Artikelomschrijving"(H) every time. I get incorrect return values when I extend this formula to other product groups.
I read that the data needs to be sorted ascending cause I use match_type 1. When I do that I get the right returns for some product groups, but the given example suddenly returns incorrect values.
I can't sort both column C and A in ascending order for the formulas to always return correct items. Can you help me to get past this hurdle?
After a little bit of google translate work, if I'm understanding your question correctly, you need to find the "Item Description" (H) of the record where the "Line" (B) = the value in N1 and the time is between the start and end times.
This is an array formula, you have to confirm it with Ctrl+Shift+Enter
=INDEX(Data!$H$2:$H$157,MATCH(1,(Data!$B$2:$B$157=$N$1)*(Data!$C$2:$C$157<$A2)*(Data!$D$2:$D$157>=$A2),0))
OR with semicolon syntax:
=INDEX(Data!$H$2:$H$157;MATCH(1;(Data!$B$2:$B$157=$N$1)*(Data!$C$2:$C$157<$A2)*(Data!$D$2:$D$157>=$A2);0))
I found the solution, thank you for pointing me in the right direction Valon Miller. This is the formula I fixed it with:
=ALS.FOUT(INDEX(Data!$H$2:$H$154;MATCH(1;(Conversie!L$1=Data!$B$2:$B$154)*((Conversie!$A32>=Data!$C$2:$C$154)*(Conversie!$A32<=Data!$D$2:$D$154));0));"")
I have 5 columns of data with around 50,000 rows. This is the ambulance response times to an incident. I am trying to figure out the total number of incidents as multiple ambulances respond to a single incident. The 'IF' function has been useful upto a certain extent where the multiple ambulances reached at the same time but when it is not at the same time, it considers it as a different incident. I would like to add a buffer of 20 minutes but I am not able to figure out how to incorporate that. The second problem is with the incident number. The incidents 2014-014374-006, 2014-014374-009 are the same, just the ending numbers are different. How do I differentiate? Can I do it in excel or other platforms?
http://imgur.com/a/30VHl
To return the incident number, use a formula like this: "=IF(ISERROR(SEARCH("-",D5,SEARCH("-",D5)+1)),D5,LEFT(D5,SEARCH("-",D5,SEARCH("-",D5)+1)-1))" where D5 is the cell with your incident number.
What this formula does is it first creates an if statement that will allow you to determine if the incident has the second dash or if it doesnt. If it doesn't, then it will return the value in the cell. If it does, it will return the text to the left of that dash. The search function looks for a substring, and by nesting a search and adding "1" to the value of the first search, we are looking for the substring that comes after the first one is found.
It is a rather confusing formula the first time you use it, but it works like a charm once you understand it.
I will see if I can figure the dates out. That might be more difficult. If you can simply use the incident number for this, you will likely have an easier time.
I've adapted this solution from a couple of years ago:
=LOOKUP(2^15,FIND(Keywords,A2),Categories)
I use this for searching within a description field for keywords in a named list, in order to return a corresponding category from an adjacent named list.
However I do not understand the significance of 2^15. Can someone explain?
Also it's unclear in what order the search operates. If two keyword options were "check" and "deposit," and they were assigned to different categories, but both appeared in the same description field cell, how do I know which will be found first? Is it placement in the string, or order in the list?
2^15 is simply an arbitrarily large number, which lookup attempts to find - when it can't find it, it takes the next lowest number.
Effectively your formula looks at Keywords, and attempts to find the value in A2. For each word that actually matches A2, it provides a non-error message. Then out of the whole list, it attempts to find that line number in categories, resulting in many errors, and a single correct value. Lookup picks the value by using 2^15. Though this seems to be a weird way of doing it; it is likely a holdover of pre-2007, as Lookup is generally used now only for backwards compatibility purposes. Also using 1 instead of 2^15 worked for a couple of simple cases that I tried when writing this up.
this is my first post so i am sorry if this is confusing at all. I am trying to use a vLookup to run a comparative analysis between two reports. I am using a part number as a reference and trying to return the cost associated with the part from one of the two reports. So, the first issue that I encountered was due to the fact that some of the part numbers had letters in them and some didn't, so to be consistent I used the following code to clean up the part numbers:
IFERROR(VALUE(F11&C11), F11&C11)
where F11 and C11 are two components of the part number that needed to be concatenated to generate the full number. Now, the vLookup will not return anything except for #N/A for a few of the part numbers that are actually in the sheet. All of the part numbers are formatted the same for the 892 part numbers that I am searching for but get a returned value on 571 of the 892 part numbers but of the remaining 321 part numbers that did not have a return, about a third actually exist in my sheet. Lastly and for example, part number 110874402 exists in both sheets but gets a #N/A from the vLookup. When I copy the value from one sheet and search it in the other sheet using Ctrl + F, I get the following:
(I have an image to show but apparently can't post it without a reputation of 10 or more...oops)
The highlighted cell shows that the value exists but Excel can't find it. Does anyone have any ideas why this is or what I could be doing differently? I've been having this issue for a few months now on separate projects and haven't found any resolution.
Thanks in advance,
try =VLOOKUP("*"&TRIM(F569)&"*", BOBJ!$D$3:$P$2237, 7, FALSE) - I have a feeling spaces may have crept around the part numbers, which means that the exact match will not work.
The TRIM takes the spaces from the cell you are looking at, and the "*"'s will allow a wildcard search - note that this also means that CAT would also match CAT1, but if it produces results where there were none before, it gives you something to check for.