IF with COUNTIF function

Ramadan

Board Regular
Joined
Jan 20, 2024
Messages
149
Office Version
  1. 2021
Platform
  1. Windows
I'm trying to use this function =IF(COUNTIF(sheet2!B:B,D7)&(sheet2!C:C,C7),sheet2!B2,"") to check IF (D7 in this sheet = any cell value in sheet2 in column B:B) and IF (C7 in this sheet = any cell value in sheet2 in column C:C) if ok so to return with "B2" value otherwise to keep the cell blank but i get #VALUE error
IF D7 = sheet2!B:B
AND IF C7 = sheet2!C:C
make the cell = B2 in sheet2, if NOT keep it blank

How to retype it in the correct way?
 
now I reached something good but still not working. I edited the formula to be like this =IF(COUNTIF(Sheet2!B:B,D7)>0,IF(COUNTIF(Sheet2!C:C,C7)>0,Sheet2!B2,""))

but while everything is matching true i get blank cell
 
Upvote 0
=IF(AND(COUNTIF(District1!B:B,D7)>0,COUNTIF(District1!C:C,C7)>0),District!B2,"")
 
Upvote 0
now I reached something good but still not working. I edited the formula to be like this =IF(COUNTIF(Sheet2!B:B,D7)>0,IF(COUNTIF(Sheet2!C:C,C7)>0,Sheet2!B2,""))

but while everything is matching true i get blank cell
Your formula works for me.
It will be interestuing to see what Kerryx's formula produces.
If that doesn't produce the correct results it would point to a data problem.

My first thought would be spaces in the cells after the data.
 
Upvote 0

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top