I want to find the value "1" in the range B1:B31 and output the value A1
Kind of like this:
If B1:B31 is 1, Then A1, Else 0
This does not work:
=IF(ISNUMBER(SEARCH("1",B1:B31)),A1,"")
What is the proper formula?
How about:
=IF(ISNUMBER(MATCH(1,B1:B31,0)),A1,0)
Related
Is there an easier and more compact way to write this formula?
[1] [2]
A 0
B 5940
C 13860
D 22500
E 87300
F 378000
=IF(Q27="A",0,IF(Q27="B",5940,IF(Q27="C",13860,IF(Q27="D",22500,IF(Q27="E",87300,IF(Q27="F",378000,"ERROR"))))))
So what it does is return the respective values in [2] if Q27 equals one of the letters in [1].
I managed to get the result I expected but I'd like to know if the code can be improved.
Thanks
That is what VLOOKUP is for. Put your table in A1:B6 then:
=VLOOKUP(Q27,A:B,2,FALSE)
Or you can "Hard Code" the VLOOKUP like this:
=VLOOKUP(Q27,{"A",0;"B",5940;"C",13860;"D",22500;"E",87300;"F",378000},2,FALSE)
Or:
=INDEX({0,5940,13860,22500,87300,378000},MATCH(Q27,{"A","B","C","D","E","F"},0))
If you have to hard-code the values then maybe,
=iferror(choose(code(upper(q27))-64, 0, 5940, 13860, 22500, 87300, 378000), "error")
The following formula:
=INDEX($B$2:$B$7,MATCH(E2,$A$2:$A$7))
Enter the value you're using to look up in cell E2. If you were to put the formula in cell Q27 as you specified, then you would get the return value in that cell. If you were to put D into cell E2, and have the formula in cell Q27, you would get 22500 in Q27.
Alternatively, if the helper cell E2 isn't an option, you could simply replace E2 in the formula with "A", or "B", or whichever specific value you're using to lookup. Be sure to include quotation marks around it. For example:
=INDEX($B$2:$B$7,MATCH("A",$A$2:$A$7))
Hopefully an easy solution:
Look for value of C2 in Column range N3:N300. If found, then put value of P* into D2.
Example:
C2 = "Cat"
Search N3:N300 for "Cat"
Finds N176 = "Cat"
Then makes D2 = value of P176, in this case, "feline"
Is there Excel formula to do this?
You want to use a VLookup function.
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
I am looking for the correct formula for a table I am working on. What I would like is:
0 for say B1 if A1 equals "None",
1 if A1 equals "In" and
2 if A1 equals "out".
Try this:
=CHOOSE(1+SEARCH(A1,"noneinout"),0,,,,,1,,2)
A little shorter:
=(A1<>"None")*(A1="In")+2*(A1="Out")
Maybe just one more.
=(A1="in")+(A1="out")*2
The formula will look something like this:
=IF(G18="None",0,IF(G18="ln",1,IF(G18="out",2,0)))
Just replace G18 with the correct cell address that contains the None|ln|out value.
Use nested if formula
=IF(A1="None", 0, IF(A1="In", 1, IF(A1="out", 2, -1) ))
I am experimenting with excel's functions. Say I have the following example values
Column
A1 - "Andrew"
B1 - "Morton"
B2 - "Andrew"
A2 - "Morton"
A3 - "2"
Why is my formula not printing the output 2?
=INDEX($A$3:$A$3,
MATCH(A1, ($A$1=$B$2:$B$2) * ($B$1 = $A$2:$A$2), 0))
The following prints the correct output 2 with single criteria.
=INDEX($A$3:$A$3,
MATCH(A1,$B$2:$B$2,0),1)
Thanks in advance.
These type of formulas don't work well with single cell ranges, as per your example.
Lets assume first names in A2:A10 and last names in B2:B10 - if you want to find the row which matches both names and return the corresponding value from C2:C10 you can use this "array formula":
=INDEX($C$2:$C$10,MATCH(1,($A$2:$A$10="Andrew")*($B$2:$B$10="Morton"),0))
confirm with CTRL+SHIFT+ENTER
....or you can add an extra INDEX function to avoid array entry
=INDEX($C$2:$C$10,MATCH(1,INDEX(($A$2:$A$10="Andrew")*($B$2:$B$10="Morton"),0),0))
How can I simplify this with VLOOKUP or LOOKUP?
IF(OR(A1=1,A1=2,A1=3,A1=4,A1=5,A1=6,A1=7),"Yes","No")
is there any way to make it more robust using VLOOKUP or any other Excel function to avoid this many or conditions?
Basically that OR condition is the same as A1<8 so just do that and get rid of the OR.
=IF(A1<8,"Yes","No")
in this example i have a list in Sheet 2 in the A column that contains all the values. In sheet 1 in cell A1 I enter the test number and you can put this formula in any cell you want
=IF(LOOKUP(A1,Sheet2!A:A,Sheet2!A:A)=A1,"Yes","No")
A bit better:
=IF(ISERROR(FIND("|"&A1&"|", "|1|2|3|4|5|6|7|")), "No", "Yes")
Assumes no one ever puts "|" into A1
This is the same:
=IF(AND(A1>0,A1<8,INT(A1)=A1),"Yes","No")
If I'm understanding correctly, you have a value in cell, say A1, and a variety of other values in cells B1:B8 and you'd like to know whether A1 matches any value present in B1:B8.
You could set up a flag variable taking value 1 if a match is found and 0 if not as follows:
=1-ISNA(MATCH(A1,B1:B8,0))
Alternatively, you could do something like:
=IF(ISNA(MATCH(A1,B1:B8,0)),"No","Yes") to output something more similar to the above.