2 cells , which match 2 columns in excel - excel

I'm trying to see if 2 cells C2, exist in the column G and H in the same order.
If yes, it will bring back the relevant cell in the F column.
However, it is not working as expected.
I've got this error message #VALEUR!
This is the formula I've used
=INDEX(F2:F60000;EQUIV(C2:D2;G1:H60000;0))
Any suggestions are welcomed.
I don't think I need VBA but it may be the case, although I hope not.

You can do it via a simple IF Condition like
=IF(C2=G2,IF(D2=H2,F2,"False"))

Related

Basic Excel 'IF Formula' Where entering by entering a value in one cell, will take the value of one of several other cells in same row

OK - so based on what I have been trying to find here - this is a laughable question to most on this site...but here it is...
I would like to write maybe an IF formula wherein, if I enter into A1 one of 7 letters it will enter into B1 the value contained in either C1,D1,E1, and so on..
For instance -
If in A1 someone types 'a' then the value of C1 goes into B1
If in A1 someone types 'b' then the value of D1 goes into B1
If in A1 someone types 'c' then the value of E1 goes into B1
Sorry for the simple explanation but really have had a hard time finding the answer on other searches / community help etc. I thought it was basic but still above my skills so I thought I would try spell it out very plainly...it seems this solutions would be as easy as blinking your eyes (or adding 2 + 2) to most of the posters on this site regarding Excel forumulas.
I just want at the point of data entry someone to type in a letter so that a value updates from one of several cells who's formulas and vaues are pre-written but for the life of me can't seem to find this seemingly simple equation through multiple searches...Thanks in advance for any help on this and sorry to ask such a basic question.
Based on your setup, you can simply use HLOOKUP but let me know if I didn't understand your question correctly.
Here is the screenshot of how I do it based on your sample:
The formula you fill out from cell D2 should be:
=HLOOKUP(B2,$F$1:$L$9,ROW(),0)
Please let me know if this is not what you want and we can work on other solutions.
Since you asked about an IF statement. You could use a nested IF statement where if the first condition is not met, you put the next IF statement in the FALSE section of the first and repeat until you have entered all your options.
=IF(A1="a",TRUE (C1),FALSE (next if statement))
The other answers are correct in that if you have more than 3 or 4 nested IF statements then you should really start looking for another cleaner solution.
=IF(A1="a",C1,IF(A1="b",D1,IF(A1="c",E1,"")))
A possible solution:
=OFFSET(B1,,CODE(A1)-96)

Excel - Formula using priority rules depending on range inputs

This is probably a simple fix (although me thinking this, means it probably isn't), so I apologise in advance if this is mere child's play.
In an excel sheet I am working on, I have a range (for the sake of this example is A1:A10) which can contain one of 3 variables (not including blanks) - A, B or C.
I require a formula in another cell to review the range in question and output a value based on the following rules in this priority:
If A appears anywhere in the column, regardless of other inputs, display A;
If B and C appear in the column, display A;
If only B appears in the column, display B;
If only C appears in the column, display C; and
If all cells within the column are blank, display blank
For rules 1-4, any blank cells within the column should not be considered. It is only where all cells are blank, i.e. rule 5, that this should be considered.
I have tried IF formulas but have found these only consider a single cell.
Also I have attempted using SUMPRODUCT along with IF but have hit a snag. The formula I used was:
IF(SUMPRODUCT(--(--(A1:A10="A")),"A",IF(SUMPRODUCT(--(A1:A10="B")),IF(SUMPRODUCT(--(A1:A10="C")),"A",IF(SUMPRODUCT(--(A1:A10="B")),"B",IF(SUMPRODUCT(--(A1:A10="C")),"C","")))))
Now I know this appears longwinded but until rule 3 it works fine. When trying for rule 4 or 5 the formula only returns FALSE
I'm all for the above formula being tweeked so that it works or for another formula entirely but I've tried searching everywhere and can't find anything on this (although this is probably down to me not phrasing my question/searches correctly).
Any help would be much appreciated. Thanks in advance!
Using your provided example, this will yield desired results:
=INDEX({"","C","B","A"},MATCH(SUMPRODUCT({3,2,1},--(COUNTIF(A1:A10,{"A","B","C"})>0)),{0,1,2,3}))
Not the easiest answer, but it works as well:
{=IF(SUM(--($A$1:$A$10="A")+(($A$1:$A$10<>"A")*(SUM(--($A$1:$A$10="B"))>0)*(SUM(--(A1:A10="C"))>0)))>0,"A",IF(SUM(--($A$1:$A$10="B"))>0,"B",IF(SUM(--($A$1:$A$10="C"))>0,"C",IF(SUM(--(ISBLANK($A$1:$A$10)))=ROWS($A$1:$A$10),""))))}
Admittedly not nearly as elegant as the above solution.

Using the 'Match' function in Excel to return a cell address

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")

Excel function like Python's "in" operator?

I'm trying to make a cell in excel check all of the cells in a column for a certain group of numbers and then display a value based on those cells. Is there any way I can do this?
EDIT: Here's a simplified spreadsheet that shows what I'm trying to do:
(My reputation isn't high enough to post images yet.)
I want to check the cells in column B for "1,4,7,10" Then put the sum of the corresponding C cells into E2.
Could you show us an example and let us know what you've tried? I'm not sure what you are wanting exactly. But based off what you asked:
Try the find(find_text, within_text, start_num) function. Copy and paste that down the entire column and you should get the results out to the side. For example:
A B
1 ABC =if(iserr(find("A", A1)), "NOT found", "FOUND")
2 XYZ =if(iserr(find("A", A2)), "NOT found", "FOUND")
Would give (in B1, B2)
FOUND
NOT found
You could also use
if(iserr(find(...)), 0, 1)
At the end of your column you could do a =sum() and you'd get the number of rows that contain the string you are looking for.
Assuming you're using a full-match on the string 1,4,7,10 you can probably use SUMPRODUCT
E2 = =SUMPRODUCT(--($B$2:$B$6="1,4,7,10"),--($C$2:$C$6))
It worked for my example, but I might have gotten it wrong!
Cant really explain whats going on in the formula, but if you evaluate it in excel and watch how it calculates it you should get an idea!

Compare 2 lists in Excel ?

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

Resources