Multiple conditions using a table and IFS statement (or AND)

janema

Board Regular
Joined
Nov 28, 2022
Messages
117
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2011
  5. 2010
Platform
  1. Windows
  2. Mobile
Can someone tell me how to lookup off a table please? I am trying to create a formula to look up based off the below table. The columns would have to equal D & E to lookup column F.

1684186603485.png


The formula would go in column O below. I would want to say that if the values in column N match the data in the table column D and if the values in column M match the data in the table column E, then bring back column F from the table. Example: the data in that first cell in column O should bring back "Gabi Shute" because Column M is Isabel Bernal and Column N is Kevin Herde like on the table.

1684186777585.png
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
=INDEX($F$2:$F$1000,MATCH(N2&M2,$D$2:$D$1000&$E$2:$E$1000,0))

Book8
ABCDEFGHIJKLMNO
1Top LeaderleaderHRBP NameleaderTop LeaderHRBP
2NameA-1NameB-1Row2NameB-5NameA-5Row6
3NameA-2NameB-2Row3NameB-6NameA-6Row7
4NameA-3NameB-3Row4NameB-7NameA-7Row8
5NameA-4NameB-4Row5NameB-8NameA-8Row9
6NameA-5NameB-5Row6NameB-9NameA-9Row10
7NameA-6NameB-6Row7NameB-10NameA-10Row11
8NameA-7NameB-7Row8NameB-11NameA-11Row12
9NameA-8NameB-8Row9
10NameA-9NameB-9Row10
11NameA-10NameB-10Row11
12NameA-11NameB-11Row12
13NameA-12NameB-12Row13
14
Sheet1
Cell Formulas
RangeFormula
O2:O8O2=INDEX($F$2:$F$1000,MATCH(N2&M2,$D$2:$D$1000&$E$2:$E$1000,0))


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.

This will possibly enable a quicker and more accurate solution for you.

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

Make sure you set any share or google to share to everyone
 
Upvote 0
=INDEX($F$2:$F$1000,MATCH(N2&M2,$D$2:$D$1000&$E$2:$E$1000,0))

Book8
ABCDEFGHIJKLMNO
1Top LeaderleaderHRBP NameleaderTop LeaderHRBP
2NameA-1NameB-1Row2NameB-5NameA-5Row6
3NameA-2NameB-2Row3NameB-6NameA-6Row7
4NameA-3NameB-3Row4NameB-7NameA-7Row8
5NameA-4NameB-4Row5NameB-8NameA-8Row9
6NameA-5NameB-5Row6NameB-9NameA-9Row10
7NameA-6NameB-6Row7NameB-10NameA-10Row11
8NameA-7NameB-7Row8NameB-11NameA-11Row12
9NameA-8NameB-8Row9
10NameA-9NameB-9Row10
11NameA-10NameB-10Row11
12NameA-11NameB-11Row12
13NameA-12NameB-12Row13
14
Sheet1
Cell Formulas
RangeFormula
O2:O8O2=INDEX($F$2:$F$1000,MATCH(N2&M2,$D$2:$D$1000&$E$2:$E$1000,0))


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.

This will possibly enable a quicker and more accurate solution for you.

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

Make sure you set any share or google to share to everyone
It won't let me upload and excel sheet or download mini-sheet so unfortunately, I can't. I am trying to find the easiest way to get the data. One of our consultants said possibly using "IFS" would work? Or maybe "AND"?
 
Upvote 0
if you click on the icon of 2 bits of paper 1 on top of the other - under the F(x) icon
then that will copy into the clip board on the PC

then goto excel and click in A1 and paste

i will add to a share dropbox - but will only be on a few days

One of our consultants said possibly using "IFS" would work? Or maybe "AND"?
OK, why ?
isn't the lookup working for you
Not sure how i would use IFS or AND to do this , hence why i posted the index/match
 
Upvote 0
if you click on the icon of 2 bits of paper 1 on top of the other - under the F(x) icon
then that will copy into the clip board on the PC

then goto excel and click in A1 and paste

i will add to a share dropbox - but will only be on a few days


OK, why ?
isn't the lookup working for you
Not sure how i would use IFS or AND to do this , hence why i posted the index/match
Didn't bring back the right answers, but maybe I typed it in wrong. I can try again.
 
Upvote 0
I tried this and got another error.

=INDEX(Status!D2:F37,MATCH(Status!D3&Status!E3,Status!F3:F37,0))

The Status! is the sheet where I'm looking up the table. I'm LOST. :(
 
Upvote 0
Still getting an error for this too. Don't think this is going to work. <sad face>

=INDEX(Status!$F$2:$F$37,MATCH(Census!M4&Census!N4,Status!$D$2:$D$37&Status!$E$2:$E$37,0))
 
Upvote 0
but maybe I typed it in wrong.
yes

you have M4 and N4 the wrong way round

it would be useful to have an XL2BB copy or a share - as posted in my first post - makes things so much easier and quicker

you said
I would want to say that if the values in column N match the data in the table column D and if the values in column M match the data in the table column E,

so
=INDEX(Status!$F$2:$F$37,MATCH(Census!N4&Census!M4,Status!$D$2:$D$37&Status!$E$2:$E$37,0))

we are looking up the value in cell N4 and looking that up in Column D row 2 to 37
And also looking up the value in cell M4 and looking that up in Column E row 2 to 37

otherwise you are matching column M with D and N with E - which is why you get a #N/A error i suspect

the way the cells and columns are concatenated is important
we joint together N4 and M4 to make 1 trxt
and then look in joining D and E
so the N looks in D and the M looks in E
hence the order

The $ fix the cells - so as you copy down , they dont move
otherwise
Status!F2:F37
as you copy down will become
Status!F3:F38
Status!F4:F39
etc
so not looking up the entire rows - as you copy down and again will give an error

this is using the sheet names you mention

Lookup Names -ETAF2.xlsx
MNO
1leaderTop Leader
2
3
4NameB-7NameA-7Row7
5NameB-8NameA-8Row8
6NameB-6NameA-6Row6
7NameB-10NameA-10Row10
8NameB-11NameA-11Row11
census
Cell Formulas
RangeFormula
O4:O8O4=INDEX(Status!$F$4:$F$24,MATCH(N4&M4,Status!$D$4:$D22&Status!$E$4:$E$24,0))


Lookup Names -ETAF2.xlsx
DEF
1Top LeaderleaderHRBP Name
2NameA-1NameB-1Row1
3NameA-2NameB-2Row2
4NameA-3NameB-3Row3
5NameA-4NameB-4Row4
6NameA-5NameB-5Row5
7NameA-6NameB-6Row6
8NameA-7NameB-7Row7
9NameA-8NameB-8Row8
10NameA-9NameB-9Row9
11NameA-10NameB-10Row10
12NameA-11NameB-11Row11
13NameA-12NameB-12Row12
Status
 
Last edited:
Upvote 0
Solution
yes

you have M4 and N4 the wrong way round

it would be useful to have an XL2BB copy or a share - as posted in my first post - makes things so much easier and quicker

you said


so
=INDEX(Status!$F$2:$F$37,MATCH(Census!N4&Census!M4,Status!$D$2:$D$37&Status!$E$2:$E$37,0))

we are looking up the value in cell N4 and looking that up in Column D row 2 to 37
And also looking up the value in cell M4 and looking that up in Column E row 2 to 37

otherwise you are matching column M with D and N with E - which is why you get a #N/A error i suspect

the way the cells and columns are concatenated is important
we joint together N4 and M4 to make 1 trxt
and then look in joining D and E
so the N looks in D and the M looks in E
hence the order

The $ fix the cells - so as you copy down , they dont move
otherwise
Status!F2:F37
as you copy down will become
Status!F3:F38
Status!F4:F39
etc
so not looking up the entire rows - as you copy down and again will give an error

this is using the sheet names you mention

Lookup Names -ETAF2.xlsx
MNO
1leaderTop Leader
2
3
4NameB-7NameA-7Row7
5NameB-8NameA-8Row8
6NameB-6NameA-6Row6
7NameB-10NameA-10Row10
8NameB-11NameA-11Row11
census
Cell Formulas
RangeFormula
O4:O8O4=INDEX(Status!$F$4:$F$24,MATCH(N4&M4,Status!$D$4:$D22&Status!$E$4:$E$24,0))


Lookup Names -ETAF2.xlsx
DEF
1Top LeaderleaderHRBP Name
2NameA-1NameB-1Row1
3NameA-2NameB-2Row2
4NameA-3NameB-3Row3
5NameA-4NameB-4Row4
6NameA-5NameB-5Row5
7NameA-6NameB-6Row6
8NameA-7NameB-7Row7
9NameA-8NameB-8Row8
10NameA-9NameB-9Row9
11NameA-10NameB-10Row10
12NameA-11NameB-11Row11
13NameA-12NameB-12Row12
Status

I will try this again now, thanks. I know you said it would be useful to have an XL2BB copy or a share, but I tried several times and it just won't work for me unfortunately. I think my computer blocks it (work computer).
 
Upvote 0
It worked after I switched M4 and N4! Thank you soooooo much!!!! :love:
 
Upvote 0

Forum statistics

Threads
1,215,333
Messages
6,124,317
Members
449,153
Latest member
JazzSingerNL

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