# IF for 2 different sheets

#### cogumelo

##### Board Regular
Hi.

I thought this would be pretty straightforward but i've come around a few problems with IF.

Code:
IF(\$BY\$1=HLOOKUP(\$BY\$1;sheet1!1:1;1;0);OFFSET(sheet1!\$B\$1;MATCH(A2;sheet1!\$A\$2:\$A\$1000;0);MATCH(\$BY\$1;sheet1!\$C\$1:\$GA\$1;0))+BX2;OFFSET(sheet2!\$B\$1;MATCH(A2;sheet2!\$A\$2:\$A\$1000;0);MATCH(\$BY\$1;sheet2!\$C\$1:\$GA\$1;0))+BX2)

What i'm trying to do here is:

IF(\$BY\$1=HLOOKUP(\$BY\$1;sheet1!1:1;1;0);

If sheet1 has the value on BY1 then:

OFFSET(sheet1!\$B\$1;MATCH(A2;sheet1!\$A\$2:\$A\$1000;0);MATCH(\$BY\$1;sheet1!\$C\$1:\$GA\$1;0))

So far works fine if it finds the value on sheet1.

However if the value is not on sheet1 i need to do the same on sheet 2

OFFSET(sheet2!\$B\$1;MATCH(A2;sheet2!\$A\$2:\$A\$1000;0);MATCH(\$BY\$1;sheet2!\$C\$1:\$GA\$1;0)))

But all i get is the N/A error.

Can anyone help out?

Putting it simple what i'm trying to do is get a value from the sheet that has the title i'm searching.

cogumelo

### Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Replies
3
Views
472
Replies
22
Views
573
Replies
5
Views
78
Replies
7
Views
365
Replies
4
Views
172

### Forum statistics

1,136,878
Messages
5,678,326
Members
419,756
Latest member
vincent86kapelski

### 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