Excel VLOOKUP N/A error - excel

I have a table setup like this:
I am trying to do a lookup, where Column D value matched one of the Column A values and returns Column C value.
The numbers in column A and D are stored as text.
My formula is VLOOKUP(F3,A1:C3,3,TRUE) but this returns "Value not available error". What is wrong with the formula?
EDIT
Figured out that some of the values were stored as general.
Now the problem is that I have to get an exact match with leading zeroes.
For example in Column D I have "27154" but in Column A I have "000027154", these should match.
But if I have "000271540" or any other variant in Column A, it should not match.
All the numbers in Column A are 9 digits long with leading zeroes where needed.

VLOOKUP(TEXT(F3, "000000000"),A1:C3,3,FALSE)
It will require creating the same value for the VLOOKUP to find the value. Looking at your example, the length of the text in column A is 9 characters. As a result, the padding is applied which will be used to search. To make it exact match, FALSE is used as last argument to VLOOKUP.

You can use wildcards in VLOOKUP:
=VLOOKUP("*"&F3,A2:C3,3,FALSE)

There's nothing wrong with the formula. The problem is that the value in A2 is text and treated as text when comparing to the number in F3.
If you can't change your values in column A, then you can use this array formula:
=SUM((F3=VALUE(A2:A3))*(C2:C3))
Enter with CTRL+SHIFT+ENTER
This will convert the values in A2:A3 as numbers for the comparison against F3.

Related

Excel: Search A Cell To See If A Cell From An Entire Column Is Present

Having trouble with a formula to solve this problem. I can do it when comparing one cell but can't figure out how to do it to check the entire column.
What I have two columns. Column A is a list of keywords. Column B is a list of Cities.
I want to compare all of Column B to see if any of those cities are contained on a cell by cell basis in column a
If I just use =ISNUMBER(SEARCH($B$2,A2)) it will compare all the cells in column A to B2 and the formula works. But I have a few hundred cells in Column B that I want to compare A2 too. I want to know if any of the words in Column B show up in the cell A2
Instead of just $B$1 I'd like to compare the entire B column (Like B:B but that doesn't work) and see if any of the words in Column B are in Cell A2.
Hope that makes sense.
Using the whole column B:B is not possible because of performance issues. But you could using a part of the column $B$2:$B$100 within an array formula.
Example:
Formula in English notation:
{=SUM(--ISNUMBER(SEARCH($B$2:$B$67,A2)))}
This is an array formula. Input it into the cell without the curly brackets and then press Ctrl+Shift+Enter to confirm. The curly brackets will then appear automatically.
How it works:
In array context ISNUMBER(SEARCH($B$2:$B$67,A2)) takes all values of $B$2:$B$67 into the formula and results in an array of {TRUE, FALSE, FALSE, TRUE, ...} dependent of whether the value is found in A2 or not. The -- gets the boolean values as numeric 0 or 1. The SUM then sums the array. So it counts how often 1 will be present.
Edit:
This needs the $B$2:$B$67 filled with values because otherwise the "" from empty cells will always be found. So to be more flexible we should check whether cells in $B$2:$B$1000 are empty and excluding those then.
{=SUM(($B$2:$B$1000<>"")*ISNUMBER(SEARCH($B$2:$B$1000,A2)))}

How to do excel formula that would Sum values from column C if column A is 'X' or 'Y' and column B is 'Z'?

I have a spreadsheet from which I need to pick out some specific values that are in one of text columns but only if other column matches the year.
I have tried following SUM with IF but I think OR portion in textual column is failing...
=SUM(IF(B:B="*Nuoma*",B:B="*(Nuomininko)*",C:C=2016,D:D))
What I need is if in column B value contains Nuoma OR (Nuomininko) AND column C is 2016 then SUM column D...
Try,
=SUM(SUMIFS(D:D, B:B, {"*Nuoma*","*(Nuomininko)*"}, C:C, 2016))
The {"*Nuoma*","*(Nuomininko)*"} provides the OR to a wildcard match on Nuoma or a wildcard match containing (Nuomininko). You must wrap the SUMIFS in a SUM but no CSE is required.
Here's a suggestion based on the fact that in your example, both strings 'Nuoma' and 'Nuominiko' contain the same string 'Nuom'. It uses SUMPRODUCT and SEARCH (as a substitute for wildcards) together with a help column for the string matching.
Cell D7 in the screenshot contains this formula:
=IFERROR(SEARCH("Nuom",B7),0)
And the summation in E15 is done by =SUMPRODUCT(E6:E13,--(C6:C13=2016),--(D6:D13=1)). In my example this evaluates to the sum of cells E10 and E14: 4 + 2 = 6.
If you prefer to avoid the help column and use an array formula instead, this one produces the same result without involving column D (don't forget to do Ctrl + Shift + Enter):
{=SUMPRODUCT(E7:E14,--(C7:C14=2016),IFERROR(SEARCH("Nuom",B7:B14),0))}
I suppose it would be relatively straightforward to extended this to more complicated situations.

extracting of specific values in a cell

I'm trying to extract specific values from a specific cell where Column A is the input and Column B is the output.
Column A Column B
AB,CD,EF,GH,IJ,KL ABCDEFGH
AB,CD,MN,EF,OP,UV ABCDEF
QR,AB,ST,CD,GH,WX ABCDGH
The formula i am using in Column B is:
=CONCATENATE(MID(A2,(SEARCH("A",A2,1)),2),MID(B2,(SEARCH("CD",B2,1)),2),MID(B2,(SEARCH("EF",B2,1)),2),MID(B2,(SEARCH("GH",B2,1)),2))
However if i am to drag down the formula until the last row, it will return a #VALUE! since some of the values in the SEARCH formula did not appear Column A.
So what I need is a generic formula that will only extract the values AB,CD,EF,GH OR whatever value is available in Column A just like in my example.
Best Regards,
I would condition on whether or not something exists, and print it accordingly:
Column B's formula uses an approach that matches
IF(ISERROR(FIND(<string>,<within_string>)),"",<string>)
and concatenates these using &. ISERROR avoids error outputs, while also helping to place content (an empty string "" in this case).

Excel: Print Values from Column A not found in Column B in Column C

I have tried finding this solution on the web but have not had success for this specific problem. In Excel 2010 I have some data in column A where each value may partially contain data in column B.
EX:
Column A might contain "http://google.com/webmasters"
Column B might contain "google.com"
This should give me a match.
I want to print in Column C all values in column A that do not contain any values from column B.
EX:
Column A
http://dir.mydomain.tdl
http://myotherdomain.tdl
http://blog.otherdomain.tdl
http://www.lastdomain.tdl
Column B
mydomain.tdl
lastdomain.tdl
Column C (results required)
http://myotherdomain.tdl
http://blog.otherdomain.tdl
Any help would be greatly appreciated.
I think I have the solution using ARRAY formula. Assuming your input AND that columns A-C have titles, or simply, strings are listed starting cells A2 and B2, do the following:
C2: type the formula =IF(OR(NOT(ISERROR(SEARCH(INDIRECT("B2:B"&(COUNTA($B:$B))),$A2)))),"",$A2) but press CTRL+SHIFT+ENTER instead of usual ENTER - this will define an ARRAY formula and will result in {} brackets around it (but do NOT type them manually!).
Autofill formula in C2 until the end of list in column A, e.g. if the last value is in A100, then autofill up to C100 (how long column B does not matter here).
You may then copy & paste obtained results as values and sort out empty strings.
Here you go! The key here - we check every string in column A for having at least one match among array of strings in column B, and return empty string in case at least one match found.
For your convenience sample file is shared: https://www.dropbox.com/s/janf0xxon4z2yh5/DomainsLookup.xlsx
Maybe not the must efficient but you could simply use two arrays - one for Column A and one for Column B. Iterate through ColumnA array to see if it exists in ColumnB array (use Array.IndexOf or .contains). If it does you could remove it from the ColumnA array and output the remaining values in Column C as the remainder.

Check the number of unique cells in a range

I have an excel sheet.
Under column E, I have 425 cells with data. I want to check if the same data (i.e. text inside the cell) is repeated anywhere else in any of the remaining 424 cells under column E. How do I do this?
For example, in E54 I have
Hello Jack
How would I check this value to see if it was in any other of these cells?
You could use
=SUMPRODUCT(1/COUNTIF(E1:E425,E1:E425))
to count the number of unique cells in E1:425
An answer of 425 means all the values are unique.
An answer of 421 means 4 values are duplicates of other value(s)
Use Conditional Formatting on all the cells that will highlight based on this formula:
COUNTIF(E:E,E1) <> 1
This is based on the column being E, and starting on E1, modify otherwise.
In Excel 2010 it's even easier, just go into Conditional Formatting and choose
Format only unique or duplicate values
If you have to compensate for blank cells, take the formula supplied above by #brettdj and,
Adjust the numerator of your count unique to check for non-blanks.
Add a zero-length string to the COUNTIFS's criteria arguement.
=SUMPRODUCT((E1:E425<>"")/COUNTIF(E1:E425,E1:E425&""))
Checking for non-blank cells in the numerator means that any blank cell will return a zero. Any fraction with a zero in its numerator will be zero no matter what the denominator is. The empty string appended to the criteria portion of the COUNTIF is sufficient to avoid #DIV/0! errors.
More information at Count Unique with SUMPRODUCT() Breakdown.
This formula outputs "unique" or "duplicates" depending if the column values are all unique or not:
{=IF(
SUM(IF(ISBLANK(E1:E425),0,ROW(E1:E425)))
=
SUM(IF(ISBLANK(E1:E425),0,MATCH(E1:E425,E1:E425,0)))
,"unique","duplicates")}
This is an array formula. You don't type the enclosing {} explicitly. Instead you enter the formula without {} and then press cmd-enter (or something else if not a Mac - go look it up!) If you want to split your formula over multiples lines for readability, use cmd-ctrl-return on a Mac.
The formula works by comparing two SUM() results. If they are equal, all the nonblank entries (numeric or text) are unique. If they are not equal there are some duplicates. The formula does not tell you where the duplicates are.
The first sum is what you get by adding up the row numbers of every non-blank entry.
The second sum does a lookup of each nonblank entry using MATCH(). If all entries are unique, MATCH() finds each entry at its own position, and the result is the same as the first sum. But if there are duplicate entries then a later duplicate will match an earlier duplicate and the later duplicate will contribute a different value to the sum, and the sums won't match.
You might have to adjust this formula:
if you want cells containing "" to count as blank, then use LEN(...)=0 for ISBLANK(...). I suppose you could put other tests in there if you wanted, but I have not tried that.
if you want to test an array not starting at row 1, then you should subtract a constant from ROW(...).
if you have a huge column of cells, you might get integer overflow when computing this sum. I don't have a solution to that.
It's a shame that Excel does not have an ISUNIQUE() function!
This may be a simpler solution. Assume column A contains data in question. Sort on that column. Then, starting in B2 (or first non-blank cell, use the following formula:
=IF(A2=A1,1,0).
Than sum on that column. When sum = 0, all values are unique.
highlight E and on the home tab select conditional formatting > Highlight Cell Rules > Duplicate Values...
It will then highlight everything that is repeated.

Resources