SOLVED

I think I need a If Then formula

Copper Contributor

Hello, and thank you for looking. I can't search because my description is moderately vague.  I want a formula that looks to see if a cell matches a value in a column and would then pull a value from another corresponding column.

 

i.e. there are a list of 100 numbers in column A and B. I want it to look at the number I enter in C1 and if it finds that number in column A, it shows the corresponding number in column B. So if I enter 60 in C1, it would search column A for 60 ,and let's say it finds it in A30 it would then show the number in B30.

 

My explanation is really convoluted, so please let me know if anyone can help, or needs more clarification.

5 Replies
best response confirmed by shawndwyer (Copper Contributor)
Solution

Hi, Assuming I understand you correctly.

 

=VLOOKUP($C$1,$A$1:$B$100,2,FALSE)

That did exactly it. Thank you so much! Could you explain how you set that up, or point me to a link where I can learn it? That will be incredibly useful for a few things I have coming up, so I would like to understand it rather than just cut and paste. 

Your welcome. Sure.

 

The syntax for Vlookup is Vlookup('Value to Search For','Range to Search In','Column Number to Return Values From','True/False'). Each of the parameters that we are inputting into the function is called an argument (Ie. this function has 4 arguments)

 

In your case we are searching for the value in C1, so C1 is our first argument for the function (Do you understand absolute vs. relative cell references? That's what the dollar signs are for, If we'd written =VLOOKUP(C1,A1:B100,2,FALSE) and copied the formula down to the next row it would change to =VLOOKUP(C2,A2:B101,2,FALSE), by using the $ we lock the formula and it would remain the same as we copy down (Or across), If you had a value in C2, C3, etc that you wanted to lookup and wanted to be able to copy the formula down than we could remove the $ from the C1 reference (So =VLOOKUP(C1,$A$1:$B$100,2,FALSE), would then read =VLOOKUP(C2,$A$1:$B$100,2,false) when copied down to the next row. Google absolute vs. relative cell references for more reading on this, very handy when you are copying a formula across multiple cells.)

 

The next argument is the range we want to search in including the range we want to return values from (A1:B100 in this case, if the value we wanted to return was in column C, then it would be A1:C100), alternately you could search the entire row (so A:B for the second argument) as opposed to limiting this to row 1 to 100.

 

The 3rd argument is the column number that we want to return values from, B being the 2nd column in the range that is our 2nd argument (A1:B100). The first argument (C1) will always be searched for in the first column of the range that is the 2nd argument (A1:B100), Vlookup can only go from left to right (Ie. we couldn't search for a value in B and return a value in A).

 

The final argument simply indicates whether a partial match would be returned (False means exact match, True means partial match), typically a partial match would only be used if our data was sorted. 

 

Does that help at all?

 

 

 

 

That is amazing. You are a giant among mortals! Thank you for all your help, and taking the time for the detailed explanation. I am much more capable now thanks to your assistance.

Your welcome. Don't hesitate to send me a message if you need a hand with anything else.

1 best response

Accepted Solutions
best response confirmed by shawndwyer (Copper Contributor)
Solution

Hi, Assuming I understand you correctly.

 

=VLOOKUP($C$1,$A$1:$B$100,2,FALSE)

View solution in original post