# Using if statements and vlookups

#### bj6264

##### New Member
Hellom I'm trying to write a formula that says if a3=ap then lookup a certain range but if a3=br then lookup another range, can another help?
bj6264

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

#### Gerald Higgins

##### Well-known Member
I think you're almost there.
You want something like this.
Code:
``````=if(a3="ap",[insert first lookup formula here],
if(a3="br",[insert second lookup formula here],
[specify what you want to do if a3 is neither "ap" nor "br"]))``````

#### bj6264

##### New Member
Hi, get an n/a answer. this is my formula
=IF(I1="ap",VLOOKUP(B3,Sheet1!\$A\$1:\$C\$14,3),IF(I1="br",VLOOKUP(B3,Sheet1!\$D\$1:\$G\$14,3),"0"))

the ap or br is a vlookup of b3 so will then use b3 for my lookup. Can you see anything obvious that I'm doing wrong?

bj6264

#### Gerald Higgins

##### Well-known Member
Well one possibility is that it's not finding the B3 value in the relevant lookup range.

I'm not sure what you mean by this -
"ap or br is a vlookup of b3 so will then use b3 for my lookup"

#### bj6264

##### New Member
Hi

thanks, all sorted

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,451
Messages
5,837,345
Members
430,496
Latest member
Steph_88

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back