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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
=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")
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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