I'm trying to figure out how to use the search function across multiple cells (that go horizontally). I can't seem to figure out what's wrong with my formula. I'm trying to search for the word in E16 ("the") across the cells D4-AQ4. The word is in actually D4 so it should turn up as found, but it doesn't. It says not found, however if I just change the formula to just look in D4 it says found. The problem is I need this formula to work so I can test for more words across all those cells to see if they are there or not. Can anyone tell me what's going on?
=IF(ISERROR(SEARCH(E16,$D$4:$AQ$4)>0),"NOT FOUND","FOUND")
You can't have a range in =SEARCH(), it will just return a #VALUE which, in your formula will give you a "Not Found". When in doubt, take out your IF and see what the conditional statement returns.
You can, however, concatenate your cell values together to make a big fat search term. The =CONCATENATE() formula will work, you can just use &:
=IF(ISERROR(SEARCH(E16,CONCATENATE(D4, E4, F4, ... AQ4))>0),"NOT FOUND","FOUND")
or
=IF(ISERROR(SEARCH(E16,D4&E4&F4& ... &AQ4)>0),"NOT FOUND","FOUND")
Either way that one will work. That concatenation is pretty tedious to write, but it's your best bet outside of a quick VBA UDF.
Related
I want to use Excel function to find a simple embedded term (partial find), and return another cell value. I managed to make a formula that sort of works, but I want to know if:
there is a more efficient formula to accomplish the same thing; and
Here is the formula: =IF(VLOOKUP("*"&B1,A6:B12,1,FALSE)="S-"&B1,VLOOKUP("*"&B1,A6:B12,2,FALSE), Not Found) This formula returns the value in B2 in the picture below.
A question/problem I have is that the wildcard "*" works in VLOOKUP but not in IF, so I'm stuck with manually entering the string "S-". Luckily the array i'm working with uses the same term ("S-") for all values, but that might change in the future and I'd like a way to deal with that. This causes the formula not to work when there is text after the number, as in the last cell in the example.
I have a matrix setup where I am using multiple HLOOKUPS in a cell to derive a result. Due to some of the source data having blank cells, the HLOOKUP results in a #VALUE! error if any of the results lookup on a blank cell. I cannot use the IFERROR function because that will negate the addition and result in the entire formula deriving a blank result when in reality a summation of numbers should result (but because of the occurence of even one blank instance, the formula does not work). The way the spreadsheet is setup, I cannot change the source data to have zero in the blank cells, even though this would essentially solve the issue in a different way. Please see the example:
(HLOOKUP(L$1&"zzz.",Formula!$1:$34,$T5,FALSE)+HLOOKUP(L$1&"yyy",Formula!$1:$34,$T5,FALSE)+HLOOKUP(L$1&"uuu",Formula!$1:$34,$T5,FALSE)+HLOOKUP(L$1&"ppp",Formula!$1:$34,$T5,FALSE)+HLOOKUP(L$1&"ccc",Formula!$1:$34,$T5,FALSE)+HLOOKUP(L$1&"ddd",Formula!$1:$34,$T5,FALSE)
Any suggestions are greatly appreciated.
Your formula can be re-written in a different and more efficient way, viz:
=SUM(SUMIF(Formula!$1:$1,L$1&{"zzz.","yyy","uuu","ppp","ccc","ddd"},INDEX(Formula!$1:$34,$T5,)))
which also has the benefit that any search values which are not found do not cause the formula to error.
Even better would be to put those six search strings in the actual worksheet somewhere, e.g. A1:A6, in which case the above becomes the even-more succinct:
=SUMPRODUCT(SUMIF(Formula!$1:$1,L$1&$A$1:$A$6,INDEX(Formula!$1:$34,$T5,)))
Regards
I am a programmer that rarely uses Excel. I'm now trying to do a simple vlookup and it just won't work. I have read several online tutorials and troubleshooting guides, no dice. Here's what I've got:
As you can see, the formula in B8 is =VLOOKUP(A8,$A$1:$B$5,1,FALSE)
I am baffled why this isn't working. I have absolutely verified that each cell in the lookup table (A1-B5) doesn't contain any leading/trailing spaces, no special chars, etc. In fact I typed these in manually, they're not pasted. Same goes for the little column of colors (A8-A11). This is the simplest case possible. For example, I want the formula in B8 to look at "Red" in A8, find Red in the lookup table, and return Red's number, which is "3". And I want an exact match.
In case you're wondering why I'm trying this on a simple and useless case, it's because I began on a more complex sheet, as part of prepping for a data import from Excel, got the #N/A everywhere, so I started a new worksheet and made this simple example, and got the same wrong result.
What am I doing wrong?
You would be better served by using index() and match() because in a vlookup(), the value that you're trying to look for has to be in the left-most column.
match() will return the number or index (in your case, the the row number) in which it finds the value you're looking for, and that can be given to index() to use to return some other value associated with that index (in this case, the color number in that row). It would end up looking like this:
=index($a$1:$a$5, match(a8, $b$1:$b$5, 0))
I found that the lookup value (color) must be in the left column and the ID must be in the right column.
VLOOKUP doesn't work to it's left, this function looks rightwards. This is why you need to swap numbers and colors.
I'm trying to tell Excel to change the cell reference for a SUMIF formula based on the last cell that contains a value in each row. Right now, I know I could write a nested if statement to do this for me, but it's far too unwieldy to be a long-term solution.
Example:
On a separate report, every person in this list has multiple lines recording their daily sales. On a small scale, I'd simply write a SUMIF that uses for A2, B3 and C4 as criteria. The scale is much much larger, so my current solution is to write out a logic check with the SUMIF formula folded into it.
In this case, the formula in E2 would be:
=IF(C2="",if(B2="",SUMIF('range',A2,'range'),sumif('range',B2,'range')),sumif('range',C2,'range'))
Is there a different way to tell Excel to run the SUMIF with the last value found in each row?
I was hoping I could use COUNTA for each row, then have the SUMIF formula use the COUNTA value to change the criterion cell reference. I'm missing something here.
=SUMIF('range',INDEX(A2:C2,MATCH("zzzzz",A2:C2)),'range')
seems worth a try.
Edit Too long for a comment:
I don’t really have any idea how =MATCH() works but think of it as traversing left to right while searching. When it fails to find a match it just happens to have been looking at the last entry and (conveniently!) offers that up. So the key is to look for something that won't be found.
For people’s names I chose “zzzzz” as unlikely to be present. For numbers anything up to 9.99999999999999E+307 is theoretically possible and hence some people use that (eg an hour ago Formula to get the first cell with a numerical value from a selection?) but I prefer a googol (1E+100) and that seems quite large enough, is much shorter – and easier to remember, even if a few 9s more or less would make no difference, nor likely what couple of integers are after the +.
What is wrong with this formula? I've tried the formula differently over and over and I can't figure out what I am doing wrong.
=IF(((ISERROR(INDEX(Voids!$B:$B,MATCH("*"&$A5,Voids!$A:$A),"",(INDEX(Voids!B:B,MATCH($A18&"*",Voids!A:A,2) )))
I am looking for part matching or semi matching text on one sheet
I assume you want something like this
=IF(ISERROR(VLOOKUP("*"&$A5,Voids!$A:$B,2,0)),"",VLOOKUP("*"&$A5,Voids!$A:$B,2,0))
Using "*"&$A5 means that the formula needs to match with a value where A5 is at the end, if it can be anywhere switch to "*"&$A5&"*"
If you have Excel 2007 or later you can use IFERROR to simplify, i.e.
=IFERROR(VLOOKUP("*"&$A5,Voids!$A:$B,2,0),"")