IF AND or INDEX/MATCH?

JoshLyman

New Member
Joined
Jan 11, 2023
Messages
35
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I'm trying to write a formula which will tell me if the selection in cell B2 appears in the "Cohort Ref" column on Sheet1, and if so, whether the value in the 'Actual Recruitment' column on Sheet1 is greater than 0. If it is, I need it to return Y, but if it isn't I need it to return N:

1676440623656.png


1676440761754.png


Initially I tried =IF(AND(B2=Table2[Cohort Ref.],Table2[Actual Recruitment]>0),"Y","N") but this only works if there's 1 line in the table on Sheet1. If there are multiple, it always returns N. I suspect I need to probably use MATCH and/or INDEX, but my experience with those is very limited!

Thanks in advance
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
or a sumifs()
but i cannot reconcile the images

I can see we would
sumifs( column E, column C , cell with dropdown (HAD 08) )
then an IF
IF( sumifs( column E, column C , cell with dropdown (HAD 08) ) >0, "Y", "N")

but i cannot see why that would be entered in the cell on image 1

Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed
 
Upvote 1
Hopefully this works

Book1.xlsx
ABCDEF
1Please choose your cohortHas this task been completed?CohortRecruitment figure
2HAD 08NHAD 080
3HAD 0914
4HAD 1025
Sheet1
Cell Formulas
RangeFormula
C2C2=IF(AND(A2=Table1[Cohort],Table1[Recruitment figure]>0),"Y","N")
Cells with Data Validation
CellAllowCriteria
A2List=Sheet2!$A$1:$A$3


A2 is going to be changed constantly, depending on who uses the sheet and which cohort they want to check on.
C2 is where my formula needs to go, and needs to check whether the recruitment figure for the cohort selected in A2 is greater than 0. If it is, it should return Y, if it isn't, it should return N
 
Upvote 0
need both sheets -
but a sumifs() should do that for you

Sheet 2
Book1
ABCDE
1cohortrecruitment
2HAD 080
3HAD 0914
4HAD 1025
Sheet2


Sheet1 - using sumifs
Book1
ABCDEF
1Please choose your cohortHas this task been completed?CohortRecruitment figure
2HAD 08NHAD 080
3HAD 09YHAD 0914
4HAD 10YHAD 1025
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=IF(SUMIFS(Sheet2!$E$2:$E$4,Sheet2!$C$2:$C$4,Sheet1!A2)>0,"Y","N")
F2:F4F2=SUMIFS(Sheet2!$E$2:$E$4,Sheet2!$C$2:$C$4,Sheet1!A2)


on dropbox
will only be kept for a few days
 
Upvote 1
Solution
this will show "N" if not found in Column Cohort

Book1
ABCDEF
1Please choose your cohortHas this task been completed?CohortRecruitment figure
2HAD 08NHAD 080
3HAD 09YHAD 0914
4HAD 10YHAD 1025
5HAD 11N
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IFERROR(IF(INDEX(F:F,MATCH($A2,E:E,0))>0,"Y","N"),"N")
 
Upvote 1
you are welcome, glad you have a solution
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,741
Members
449,050
Latest member
excelknuckles

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