# Comparing cells via Vlookup then returning text

#### antinora

##### Board Regular
I'm blanking on a nested If statement. I have 2 worksheets. In sheet 1 a a list of student ID numbers. In sheet 2 is a list of student ID numbers for daily absentees. I want to compare both columns of IDs and return Presents if m atch else Absent.

Since no match returns #N/A the formula I'm using returns Present but I want Present else Absent.

I'm using =IFERROR(VLOOKUP(A2,abs!\$A\$1:\$A\$748,1,FALSE),"Present")

Is there a If then else vlookup type nested formula?

Thank you

### Excel Facts

Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

#### JoeMo

##### MrExcel MVP
Untested, but try this:

=IF(ISNA(MATCH(A2,abs!\$A1:\$A\$748,0)),"Present","Absent")

#### Momentman

##### Well-known Member
I'm blanking on a nested If statement. I have 2 worksheets. In sheet 1 a a list of student ID numbers. In sheet 2 is a list of student ID numbers for daily absentees. I want to compare both columns of IDs and return Presents if m atch else Absent.

Since no match returns #N/A the formula I'm using returns Present but I want Present else Absent.

I'm using =IFERROR(VLOOKUP(A2,abs!\$A\$1:\$A\$748,1,FALSE),"Present")

Is there a If then else vlookup type nested formula?

Thank you
I would prefer to use a MATCH function but following your convention, try the below
Excel Formula:
`` IF(ISNA(VLOOKUP(A2,abs!\$A\$1:\$A\$748,1,FALSE)),"Present" ,"Absent")``

#### MuchToLearn

##### New Member
Assuming old Student ID are unique in each sheets, and Student ID in 'sheet abs' is subset of Student ID in "sheet1", why not just use =IF(COUNTIF(abs1!\$A\$1:\$A\$748, A2)=0,"Present","Absent"))?

Replies
8
Views
60
Replies
1
Views
64
Replies
1
Views
62
Replies
7
Views
176
Replies
3
Views
113

1,127,040
Messages
5,622,343
Members
415,894
Latest member
silverhaze

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