Return user define value using IF & OR

atisyam

New Member
Joined
Sep 19, 2018
Messages
37
Hello. I am comparing 2 different workbooks. I want this formula to return a "P" if the cell values in the 2nd workbook (Trial31) contains "Pass/Pass" or "Pass/Fail". Else if none of these 2, return an "O".

I'm also using COUNTIFS as apart from the above, I also need to check if another set of cell values from
the 2nd workbook
(Trial31) contains matching data in cell D1 of my 1st workbook.

The formula below returns an error. Hope to get help. Thanks.

Code:
=IF((COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Fail") OR (COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Pass"))>0,"P","O"))
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
5,714
Office Version
  1. 365
Platform
  1. MacOS
=IF((COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Fail") OR (COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Pass"))>0,"P","O"))

(COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Fail") OR (COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Pass"))>0

you need to use , assuming the counts are OK

OR (COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Fail")>0 , COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Pass")>0)

i also notice a space between sheet1 and the !

You are also counting a different workbook , is that in the sme directory and is it open or closed ?


IF ( OR (COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Fail")>0 , COUNTIFS('[Trial31.xlsx]Sheet1 '!$B$2:$B$10,D1,'[Trial31.xlsx]Sheet1 '!$K$2:$K$10,"Pass/Pass")>0) , "P","O")
 

atisyam

New Member
Joined
Sep 19, 2018
Messages
37
Hi Wayne

Thanks for your help. Both the workbooks are from the same directory (Desktop) and both are opened, side by side.

The last formula worked perfectly. Thanks again.
 

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
5,714
Office Version
  1. 365
Platform
  1. MacOS
you are welcome
 
Master Excel Bundle

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.

Forum statistics

Threads
1,164,628
Messages
5,838,452
Members
430,549
Latest member
jayjay2022

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
Top