Grab Corresponding Column based on Drop Down Header

dwgnome

Active Member
Joined
Dec 18, 2005
Messages
441
Looking to modify existing formula that works to allow for use of a drop down header and then lookup the corresponding column based on the year portion of the drop down.

So in Column Q starting at row 2, I have the following:

Code:
=[SIZE="2"]IF(OR(ISBLANK(A2),ISBLANK(K2),ISTEXT(K2)),"",IF(OR(ISBLANK(INDEX(KeyGalEq,MATCH($A2,KeyPCN,0),1)),ISTEXT(INDEX(KeyGalEq,MATCH($A2,KeyPCN,0),1))),"No Equiv Gallonage",IF(ISERROR(INDEX(KeyGalEq,MATCH($A2,KeyPCN,0),1)),"No Equiv Gallonage",K2*INDEX(KeyGalEq,MATCH($A2,KeyPCN,0),1))))[/SIZE]

Where KeyGalEq and KeyPCN are defined named ranges. K2 holds the numerical data for a specific year as indicated by the text header in K1, in this case “Net Issue 2009”. I made the header at Q1 a dropdown list that displays one of three choices for different years eg. “2008 Usage”, “2009 Usage”, “2010 Usage”. I need to have the text in these headers so I can’t just use numbers.

I would like the formula above to be able to extract the number portion in Q1 and compare it to the “year” within text headers in J1, K1, and L1 and then choose the corresponding column from which the data will be used. So the K2 in my original formula may be J2 or L2 depending on the year chosen.

I cannot use Excel Jeanie or similar program at work due to administrative rights etc. so I hope the explanation above will be sufficient to get someone started. Also I am not sure how to get around the fixed column portion of ISBLANK(K2) and ISTEXT(K2) check at the beginning of the formula. I am willing to loose that if I can get the other part of the formula to do what I would like.

Any assistance would be appreciated.
 

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.

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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