How to find the column index for a combination of two values in two differnet rows.

OaklandJim

Well-known Member
Joined
Nov 29, 2018
Messages
869
Office Version
  1. 365
Platform
  1. Windows
In a worksheet I have two named ranges: Providers and PlanNames. Providers is a list of insurance providers and PlanNames lists corresponding plan types.

SadeInsurance_ver3h.xlsm
DEFGHIJKLMNOPQRSTUVW
61234567891011121314151617181920
7AnthemAnthemBlue ShieldBlue ShieldHumanaHumanaSilverScriptsWellcareWellcareWellcareCignaCignaCignaUHCUHC
8BasicPlusPlusEnhancedValue RXPremierChoiceValue ScriptClassicValue PlusSaver RxAssuranceExtraPreferredSaver
Drugs
Cell Formulas
RangeFormula
D7:W7D7=IF(TRANSPOSE('Drug Plans'!Providers)=0,"", TRANSPOSE('Drug Plans'!Providers))
D8:W8D8=IF(TRANSPOSE('Drug Plans'!Plans)=0,"", TRANSPOSE('Drug Plans'!Plans))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
'Drug Plans'!Plans='Drug Plans'!$C$5:$C$24D8
'Drug Plans'!Providers='Drug Plans'!$B$5:$B$24D7
ProvidersList_DrugPlansWorksheet=OFFSET('Drug Plans'!Header_Plans,1,0,'Drug Plans'!Entries_Count,1)D7
'Drug Plans'!rrPlan='Drug Plans'!$C8D8
'Drug Plans'!rrProvider='Drug Plans'!$B7D7


I need to determine the "data column" index for a provider name/plan type combination. That is, the index sought is the "data column" number not worksheet column.

In a formula I would specify the provider name and plan type and the formula returns the data column index.

Example: the combination of Anthem and Plus returns the index of 2. Example: the combination of Humana Premier returns the index of 6.

I really appreciate any assistance with this.

Have a great day
Jim
 
I figured this out. I added another range called PlanIndeces and used that with XLOOKUP like so...

=XLOOKUP(1, (Drugs!Providers=rcProvider)*(Drugs!PlansNames=rcPlanName),Drugs!ProviderPlansIndeces)
 
Upvote 0
Solution
provider name/plan type combination
What cells contain the provider name and plan that you want to look for?

The following formula assumes they are in A1 and A2 respectively, not enough information in your post to know:

Excel Formula:
=MATCH(A1 & A2, 'Drug Plans'!Providers & 'Drug Plans'!Plans, 0)
This is an array formula but you don't have to do anything special to enter it in 365.
 
Upvote 0
Hmm, for some reason XL2BB is not cooperating with me right now, but this should suffice:
1740157543135.png

Formula in D10: =XLOOKUP(D11&D12,D7:R7&D8:R8,D6:R6,"")
 

Attachments

  • 1740157507959.png
    1740157507959.png
    6.7 KB · Views: 0
Upvote 0

Forum statistics

Threads
1,226,840
Messages
6,193,283
Members
453,788
Latest member
drcharle

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