Fill cells with text if cells in column have specific text string

basicallychels

New Member
Joined
Sep 8, 2014
Messages
12
I am trying to create something that will allow me to autofill the agency column with an Agency's name if the adjacent Facility Name cell contains a certain text string. So for example, if the Facility Name is Sacramento, Union City, Ventura, Fresno, Riverside, or Cypress I want to fill the adjacent Agency cell with VIC the PICC. But if the Facility Name is Glasgow, Louisville, Westlake, etc. I want to fill the adjacent Agency cell with Access RN. I have to do this each month, so if I could find something that would be easy to apply each month, like a macro, that would be awesome. I am just not sure what the best way to go about this is, since I have multiple agencies that go with multiple facilities.



AgencyFacility Name
VIC the PICCSACRAMENTO
HOUSTON

<tbody>
</tbody>
 
I don't believe two different arrays can be used for a reference in an Index.

You could try these two in their own columns, then merge them:

Column A:
=IFERROR(INDEX(Sheet1!$C$27:$C$545,MATCH(E2,Sheet1!$B$27:$B$545,0)),"")

Or

If need E2 compared to B27:B545 & A2 compared to D3:D:32 use:
{=IFERROR(INDEX(Sheet1!$C$27:$C$545,MATCH(E2&A2,Sheet1!$B$27:$B$545&Sheet2!$D$3:$D$32,0)),"")}
- To get { }, use Ctrl + Shift + Enter, don't manually add them.

Column B:

=IFERROR(INDEX(Sheet2!E3:E32,MATCH(A2,Sheet2!D3:D32,0)),"")

Or

{=IFERROR(INDEX(Sheet2!E3:E32,MATCH(E2&A2,Sheet1!$B$27:$B$545&Sheet2!$D$3:$D$32,0)),"")}



Column C [aka Results] (taking whatever the result of Column A first, if Column A is blank, take Column's B result):
=if(a1="",b1,a1)
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,365
Messages
6,124,511
Members
449,166
Latest member
hokjock

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