IFAND formula

Daithi

New Member
Joined
Feb 28, 2014
Messages
15
Apologies if this has been covered. I looked at many posts before writing.

I have 2 worksheets, A & B.

I need my formula to look at cell A2 in Sheet B and compare it to Cell A2 in Sheet A. If they match AND the value in sheet A cell B2 is Individual, I want to return the value in Sheet A cell C2.

This is as far as I got.

=IF(AND(A2=SheetA!A2:$A$1999),SheetA!$B$2:$B$2004="Individual",SheetA!$F$2:$F$1999)

Any help gratefully received.

David
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
What you described would be something like this.
I need my formula to look at cell A2 in Sheet B and compare it to Cell A2 in Sheet A. If they match AND the value in sheet A cell B2 is Individual, I want to return the value in Sheet A cell C2.

Excel Workbook
ABCD
1
2testindividualReturn Value
3Return Value
4
5
SheetA
Excel Workbook
AB
1
2test
3
SheetB




However looking at your formula it's unclear.
Where does F2:F1999 come from if you want to return value in C2?
Are you trying to match A2 to a range of values A2:A1999 or just A2 to A2?
 
Upvote 0
Hi

Thanks for the quick reply. Yes, you are correct. My spreadsheet does have 1,999 rows. My plan was to fill the formula down. I notice that I wasn't clear enough in my post.

My formula would be in Sheet B, Cell C2.
It needs to look at Cell A2 in Sheet B and compare this value to Cell A2 in Sheet A.
If they match AND the value in Sheet A Cell B2 is Individual, I want to return the value in Sheet A Cell F2.

Appreciate your patience
 
Upvote 0
Copy formula down as needed.

Excel Workbook
ABC
1
268Test1
331
468
536
632
757
893Test7
935
1054
1196Test10
1243
1363Test12
SheetB
Excel Workbook
AB
1
268individual
331Test
468Test
545individual
632Test
757Test
893individual
935Test
1054
1196individual
1243Test
1363individual
SheetA
 
Upvote 0
Brilliant!!!! Thank you so very much.


Copy formula down as needed.

SheetB

ABC

<colgroup><col style="width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: right"]68[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Test1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: right"]31[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: right"]68[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="align: right"]36[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="align: right"]32[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]
[TD="align: right"]57[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]8[/TD]
[TD="align: right"]93[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Test7[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]9[/TD]
[TD="align: right"]35[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]10[/TD]
[TD="align: right"]54[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]11[/TD]
[TD="align: right"]96[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Test10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]12[/TD]
[TD="align: right"]43[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]13[/TD]
[TD="align: right"]63[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Test12[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
C2=IF(AND(A2=SheetA!A2,SheetA!B2="individual"),SheetA!F2,"")

<tbody>
</tbody>

<tbody>
</tbody>


SheetA

AB

<colgroup><col style="width:30px; "><col style="width:64px;"><col style="width:99px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: right"]68[/TD]
[TD="align: center"]individual[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: right"]31[/TD]
[TD="align: center"]Test[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: right"]68[/TD]
[TD="align: center"]Test[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="align: right"]45[/TD]
[TD="align: center"]individual[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="align: right"]32[/TD]
[TD="align: center"]Test[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]
[TD="align: right"]57[/TD]
[TD="align: center"]Test[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]8[/TD]
[TD="align: right"]93[/TD]
[TD="align: center"]individual[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]9[/TD]
[TD="align: right"]35[/TD]
[TD="align: center"]Test[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]10[/TD]
[TD="align: right"]54[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]11[/TD]
[TD="align: right"]96[/TD]
[TD="align: center"]individual[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]12[/TD]
[TD="align: right"]43[/TD]
[TD="align: center"]Test[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]13[/TD]
[TD="align: right"]63[/TD]
[TD="align: center"]individual[/TD]

</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Your solution worked perfectly when the values in Sheet B, Column A are unique. My worksheet has the same value repeated multiple times. I wish I could upload even a screen shot of what I'm doing.
 
Upvote 0
One way to post a small sample is to put a boarder around the cells and then use copy / paste to insert into the forum.
What do you want to see when items repeat?
 
Upvote 0
Sheet A[TABLE="width: 514"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]ExampleID[/TD]
[TD]Name Format[/TD]
[TD]Title[/TD]
[TD]First Name[/TD]
[TD]Middle[/TD]
[TD]Last Name[/TD]
[TD]Suffix[/TD]
[/TR]
[TR]
[TD]Example0001[/TD]
[TD]Business[/TD]
[TD]Mr[/TD]
[TD]John[/TD]
[TD][/TD]
[TD]Jones[/TD]
[TD]OBE[/TD]
[/TR]
[TR]
[TD]Example0002[/TD]
[TD]Business[/TD]
[TD][/TD]
[TD]J[/TD]
[TD][/TD]
[TD]Robson[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0003[/TD]
[TD]Family[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0004[/TD]
[TD]Individual[/TD]
[TD]Dr[/TD]
[TD]John[/TD]
[TD]T[/TD]
[TD]Thompson[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0005[/TD]
[TD]Individual[/TD]
[TD]Mr & Mrs[/TD]
[TD]John & Mary[/TD]
[TD][/TD]
[TD]Blakely[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0006[/TD]
[TD]Individual[/TD]
[TD]Prof.[/TD]
[TD]Tom[/TD]
[TD]M[/TD]
[TD]Smith
[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]

Sheet B

[TABLE="width: 343"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]ExampleID[/TD]
[TD]Name Format[/TD]
[TD]Last Name[/TD]
[/TR]
[TR]
[TD]Example0001[/TD]
[TD]Business[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0002[/TD]
[TD]Business[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0003[/TD]
[TD]Family[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0004[/TD]
[TD]Individual[/TD]
[TD]Thompson[/TD]
[/TR]
[TR]
[TD]Example0005[/TD]
[TD]Individual[/TD]
[TD]Blakely[/TD]
[/TR]
[TR]
[TD]Example0006[/TD]
[TD]Individual[/TD]
[TD]Smith[/TD]
[/TR]
[TR]
[TD]Example0006[/TD]
[TD]Individual[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Example0006[/TD]
[TD]Individual[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]

In this example Smith would be returned/repeated

One way to post a small sample is to put a boarder around the cells and then use copy / paste to insert into the forum.
What do you want to see when items repeat?
 
Upvote 0
Try:
This is an array formula and must be entered with CTRL-SHIFT-ENTER.
Drag formula down as needed.

Excel Workbook
ABC
1ExampleIDName FormatLast Name
2Example0001Business 
3Example0002Business 
4Example0003Family 
5Example0004IndividualThompson
6Example0005IndividualBlakely
7Example0006IndividualSmith
8Example0006IndividualSmith
9Example0006IndividualSmith
SheetB
Excel Workbook
ABCDEFG
1ExampleIDName FormatTitleFirst NameMiddleLast NameSuffix
2Example0001BusinessMrJohnJonesOBE
3Example0002BusinessJRobson
4Example0003Family
5Example0004IndividualDrJohnTThompson
6Example0005IndividualMr & MrsJohn & MaryBlakely
7Example0006IndividualProf.TomMSmith
SheetA
 
Upvote 0
YES!!!!

Thank you so very much :)

AhoyNYES C;5091462 said:
Try:
This is an array formula and must be entered with CTRL-SHIFT-ENTER.
Drag formula down as needed.

SheetB

ABC
Example0001Business
Example0002Business
Example0003Family
Example0004Individual
Example0005Individual
Example0006Individual
Example0006Individual
Example0006Individual

<colgroup><col style="width:30px; "><col style="width:115px;"><col style="width:108px;"><col style="width:93px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="bgcolor: #c0c0c0"]ExampleID[/TD]
[TD="bgcolor: #c0c0c0"]Name Format[/TD]
[TD="bgcolor: #c0c0c0"]Last Name[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Thompson[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Blakely[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Smith[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]8[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Smith[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]9[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]Smith[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
C2{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A2&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C3{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A3&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C4{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A4&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C5{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A5&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C6{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A6&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C7{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A7&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C8{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A8&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}
C9{=IFERROR(INDEX(SheetA!$F$2:$F$7,MATCH(SheetB!$A9&"/"&"Individual",SheetA!$A$2:$A$7&"/"&SheetA!$B$2:$B$7,0)),"")}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


SheetA

ABCDEFG
Example0001BusinessMrJohn JonesOBE
Example0002Business J Robson
Example0003Family
Example0004IndividualDrJohnTThompson
Example0005IndividualMr & MrsJohn & Mary Blakely
Example0006IndividualProf.TomMSmith

<colgroup><col style="width:30px; "><col style="width:110px;"><col style="width:105px;"><col style="width:74px;"><col style="width:93px;"><col style="width:51px;"><col style="width:85px;"><col style="width:43px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="bgcolor: #c0c0c0"]ExampleID[/TD]
[TD="bgcolor: #c0c0c0"]Name Format[/TD]
[TD="bgcolor: #c0c0c0"]Title[/TD]
[TD="bgcolor: #c0c0c0"]First Name[/TD]
[TD="bgcolor: #c0c0c0"]Middle[/TD]
[TD="bgcolor: #c0c0c0"]Last Name[/TD]
[TD="bgcolor: #c0c0c0"]Suffix[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]

</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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