Match a person's name to multiple states

mkyb14

Board Regular
Joined
Aug 30, 2008
Messages
56
always feels good to come back to Mr. Excel, feels like I'm learning something new.

Anyways, I have a master sheet of accounts with a state they are located in.
On another sheet I have an engineer assigned and multiple states they will cover for those accounts.

Sheet 1
Company A, CA, insert name of engineer from sheet 2 here<insert engineer="" name="">
Company B, NY, same<insert engineer="" name="">

Sheet 2 - legend for assignments
John Smith, CA, TX, OK
Jane Oliver, TN, WA, NY
James Dunn, OH,MN,ILL,ND,SD,MT

How can I in sheet 1, reference the assignments and state of the company and return the name of the engineer? I've been bouncing around google and can't seem to make anything work. is this an index,match etc? since there are something like 9 engineers assigned to all the states </insert></insert>
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hello, how is your data laid out? Is "Company A, CA" in one cell, or is "Company A" and "CA" in separate cells?

Same for this: John Smith, CA, TX, OK are each of the items, name and each state in separate cells?
 
Upvote 0
Hello, how is your data laid out? Is "Company A, CA" in one cell, or is "Company A" and "CA" in separate cells?

Same for this: John Smith, CA, TX, OK are each of the items, name and each state in separate cells?


yes, everything is in a separate column.
 
Upvote 0
you can use Index and sumproduct function to get what you want

=INDEX(sheet2!$A$1:$G$3,SUMPRODUCT(--(sheet2!$A$1:$G$3=B2)*ROW(sheet2!$A$1:$G$3)),1)

sheet2!$A$1:$G$3 is legend for assignments
B2 is the company location(state)
 
Upvote 0
change the range to $A$1:$D$7, then it will work fine.

The first state "ca": sumproduct(XXXX) return 5 which is the row count from row1, but the range you chosen only have 3 rows. Errors then happened.
 
Upvote 0
@ mkyb14


Book1
ABCD
4Engineer NameStates they support
5John Smithcatxok
6Jane Smithaztnmn
7James Dunnwaormd
Sheet2


Book1
ABC
1Company NameStateengineer match state
2Company AcaJohn Smith
3Company BtxJohn Smith
4Company CmnJane Smith
5Company DmdJames Dunn
Sheet1


In C2 control+shift+enter, not just enter, and copy down:

=IF(COUNTIFS(Sheet2!$B$5:$D$7,$B2),INDEX(Sheet2!$A$5:$A$7,MIN(IF(Sheet2!$B$5:$D$7=$B2,ROW(Sheet2!$A$5:$A$7)-ROW(INDEX(Sheet2!$A$5:$A$7,1,1))+1))),"nat available")
 
Upvote 0
@ mkyb14

ABCD
Engineer NameStates they support
John Smithcatxok
Jane Smithaztnmn
James Dunnwaormd

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]4[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]7[/TD]

</tbody>
Sheet2
ABC
Company AcaJohn Smith
Company BtxJohn Smith
Company CmnJane Smith
Company DmdJames Dunn

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]Company Name[/TD]
[TD="align: center"]State[/TD]
[TD="align: center"]engineer match state[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

</tbody>
Sheet1

In C2 control+shift+enter, not just enter, and copy down:

=IF(COUNTIFS(Sheet2!$B$5:$D$7,$B2),INDEX(Sheet2!$A$5:$A$7,MIN(IF(Sheet2!$B$5:$D$7=$B2,ROW(Sheet2!$A$5:$A$7)-ROW(INDEX(Sheet2!$A$5:$A$7,1,1))+1))),"nat available")

That worked, Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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