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
Related
I have done quite a bit of searching on this, and have found a way to set up nearly every kind of formatting rule except for this specific case. I need an entire row of the table to be highlighted only when two different conditions are present. The two conditions are:
1 cell in column E does not contain “text 1”
2 cell in column H does contain “text 2”
I need the whole table (upwards of a few thousand rows, by 12-ish columns) to be considered, and I can’t modify any of the data in the tables, or the sheets themselves.
After some playing around with solutions to similar but different problems, I ended up with a formula that seems like it should work... the logic seems right, and I’m pretty sure the syntax is correct also, but when I add the formula to the conditional formatting rule, nothing happens. It accepts the formula, but it just does nothing.
I tested it out by applying the formula to a simple test sheet and put it in column C, and it results in “TRUE” being in column C when the conditions are present, and “FALSE” being in column C when one or both of them are not present, which seems like it’s behaving correctly. Any tips would be appreciated!
Here’s what I have currently:
=AND(IF(IFERROR(SEARCH(“text 1”, $E1), 0),FALSE,TRUE),IF(IFERROR(SEARCH(“text 2”, $H1),0),TRUE,FALSE))
(Edit: there are asterisks before and after the “text 1” and “text 2”, inside the quotes.)
When using a formula in CF you must produce a formula which evaluates to either TRUE or FALSE, as in
=AND(ISERROR(SEARCH("text 1", $E1)),ISNUMBER(SEARCH("text 2", $H1)))
I have been working on an IF statement where there are multiple answers but I can't seem to get the formula to work. The If statement is going to look at two columns of data and should pull back the first NUMBER. Sometimes the first column will say "#N/A N/A" in which case the formula should look to the second column and pull that NUMBER. If both columns say "#N/A N/A" then I would like the answer to be "NR".
In another scenario I will have three columns of data. I would like the formula to pick up the first number in the columns no matter what follows. Again, if all three columns say "#N/A N/A" I would like the answer to be "NR".
I will attach two examples of what I am talking about. Here is the formula I have now but I can't seem to get it to work:
=IF(ISBLANK(B3),"",IF(D3="#N/A N/A",$D3,$D4))
Unfortunately, this formula isn't taking into account if D3 is actually a number. It also doesn't account for if both D3 and D4 are "#N/A N/A".
Any help would be greatly appreciated.
Thanks,
Here is the example :
This allows the use of many columns without the need for multiple nested ifs.
It will return the first column that is not #N/A N/A:
=IFERROR(INDEX(3:3,,AGGREGATE(15,6,COLUMN(D3:E3)/(D3:E3<>"#N/A N/A"),1)),"NR")
So to do more columns simple change both the D3:E3 to the range desired. The 3:3 should match the row being searched.
You can check each cell (from left to right) and return the first instance of a numerical value using a combination of IF & ISNUMBER
Checking 2 Columns
=IF(ISNUMBER(D3),D3,IF(ISNUMBER(E3),E3,"NR"))
Checking 3 Columns
=IF(ISNUMBER(D3),D3,IF(ISNUMBER(E3),E3,IF(ISNUMBER(F3),F3,"NR")))
I have a long column in an Excel spreadsheet that I'd like to match with another long column in the same sheet.
The columns look like:
And I want to make a script that will allow me to check A to F using B to copy and paste F,G,H to B,C,D if A and F match to look like:
The problem is that A and F don't usually match exactly; only most of the words - as you can see with "metal corp & company" vs "metal corp".
Is there any way I can do this via script? I know I can see if they match exactly using something like =NOT(ISERROR(MATCH(A2,$F$2:$F$5, 0))) etc....Or to explicitly state the name in quotations, but nothing to match only part of the entry to another.
Also, is there any way to automatically paste F,G,H if the match is found?
Ok, you can do a vlookup and break the formula with copy/paste values if needed. you may not need to do that.
So, you need to consider how to make vlookup work. vlookup can take a value and search for it in an array and return a corresponding value in that row of the array that it is found. given your ask for the following values along the right, this should work well if we can get a value to be matched. afterwards just repeat the same formula with +1 to each column being returned (F, G, H).
So, your issue is getting the match to work since you think most of the time the values do not match 100%, but are close. you need to make them match, somehow. either by manually assigning an lookup table where the alias's are aligned. e.g. on another sheet, in column A, have "metal corp & company" and in column b, have "metal corp" or by a formula to establish a match. depending on the number of rows, doing it manually may be substantially less work than a formula. a formula can work it the alias's are consistently wrong in a certain fashion. if it is random, then a formula won't work.
I would try something as simple =vlookup(value,array,column,TRUE). the true value will return an approximate match instead of exact match.
See example screenshot, the only formula is in column B. "hi" is close enough to "high" and then "there" is returned from column e.
The vlookup function appears to be broken. It is returning the same value for all lookups, but it should not.
I have it set like so:
=VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1)
Where the lookup value is in the B column and the result is in the A column.
I use the $ so the rows are not auto-updated to A3:B674 etc as I paste the formula down the rows. However, even if I manually enter that formula into the next row, it is not finding the correct value.
IF i remove the "$", the correct values are found for the first rows where the values fall within the modified range (e.g. Asset_Mapping!A3:B674) but eventually as expected it stops finding the values as the range is invalid.
What am I doing incorrectly here? I have formulas set to auto-calculate.
Without testing on your actual data it's hard to confirm this will work but add the false parameter. This will find exact matches and not the first partial match.
=VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1, false)
Collating the points together and clarifying the formula
Parameter 1: The value you are looking for
Parameter 2: The table with the data. First column is the value you are looking for.
Parameter 3: The column number of the value you want to show.
Parameter 4: If you want an exact match or partial match.
#Jeeped made the point of ordering data to get more reliable results. Good advice.
Andres has the right idea, but there is a faster way to fix the problem.
If it is returning the same value over and over again for your whole range, you probably have your Calculation Options set to "Manual".
Go into Formulas on the top ribbon and choose Calculation Options. There, you can change your calc method to "Automatic".
Also lookup value must be in first column.
Where the lookup value is in the B column and the result is in the A column.
VLOOKUP always lookup in the left-most column and returns a value from the column number specified. If you want to reverse the lookup/return order then use INDEX(..., MATCH(...))
=INDEX(Asset_Mapping!A$2:A$673, MATCH(A3, Asset_Mapping!B$2:B$673, 0))
Note that you were using a sorted, binary lookup; I've changed this to an exact match lookup which does not require sorted data.
Just in case adding a solution to this topic.
Don't know why in big tables Vlookup and Index+Match tend to show just the value of the first result in all the other cells.
In my case to fix this, after I've copied the formula in the whole range, I choose any cell containing it, press F2 and then Enter. It kind of forces excel to process everything.
I've been working on this for a week with no results. I've created this same spreadsheet for another apartment community without any issues, but for some reason, I cannot get the proper results in this spreadsheet. I've tried vlookup as well, but that didn't help either. any more advice?
Formula
Result and lookup vectors
I have a list of numbers in a table that I would like to search for and bring back the cell reference of where that number resides. For example the data looks like:
A B C D
1 1 2 3 4
ok it doesn't come out very well as the first one is the row number and then each number below sits under each letter, so C1 would contain '3'....
If I wanted to return the reference number of C1 in a cell I am using the formula of =CELL("address",MATCH(AU14,C1:AG1)) but this just errors. I have tried to put an Index in there too, but I believe that index only works vertically so this bring back a #N/A result.
Can anyone assist as I've wasted too much time on this already! :)
You are indeed missing an INDEX. And INDEX works vertically, horizontally, or both depending on how it's called.
Here is a formula that works for the ranges in the pictures. Should be easy to modify.
Formula in C5
=CELL("address",INDEX(B2:F2,MATCH(C4,B2:F2,0)))
formula
results
To make CELL work you need a cell reference, e.g.
CELL("address",C1)
The trouble is that MATCH just gives you a number, not a cell reference.
Probably the easiest way is to use the ADDRESS function, so a first try might be
=ADDRESS(1,MATCH(AU14,C1:AG1,0)+2)
That would give you the right answer if AU14 contained 3, but isn't considered to be very good because it wouldn't update if you deleted/inserted rows or columns.
A better one would be
=ADDRESS(ROW(C1),MATCH(AU14,C1:AG1,0)+COLUMN(C1)-1)
Then you might want to put in some error handling for the case where it's not found
=IFERROR(ADDRESS(ROW(C1),MATCH(AU14,C1:AG1,0)+COLUMN(C1)-1),"Not found")