Limit in excel data validation source code

BrightJovanny

New Member
Joined
Jul 19, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
  3. Web
I have an excel file with two sheets. The second sheet (Report) contains data validation cells based on the first sheet (Data). From the second sheet, the drop-down list that displays in the Select XXX depends on the selection in the Generate Report. When the Generate Report is set to anything beyond the first five in its list, the Select XXX displays year as a default list (no problem with this) via the code `...INDIRECT("Year")...`. The problem is that excel does not allow for addition of more code (seems I hit the limit). The question is - how can I manipulate this code to accommodate every option in the Generate Report? or perhaps, is there another method to implement?

The data validation source code for the drop-down list is
Code:
=IF($B$4=Data!$Q$5,INDIRECT("Client"), IF($B$4=Data!$Q$6,INDIRECT("Month"), IF($B$4=Data!$Q$7,INDIRECT("Product_Service"), IF($B$4=Data!$Q$8,INDIRECT("Sector"), IF($B$4=Data!$Q$9,INDIRECT("Trans_Type"),INDIRECT("Year"))))))

Please, see the sample file at <Sample.xlsx>
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Welcome to the MrExcel board!

Try this as your DV formula

=INDIRECT(CHOOSE(MATCH(B4,Data!$Q$5:$Q$12,0),"Client","Month","Product_Service","Sector","Trans_Type","Year","Year","Year"))
 
Upvote 0
Cross posted Limit in excel data validation source code

While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Thank you very much. I never thought of using choose-match function, but rather than having to list all the range names, I think it would be useful to create a second column and refer to it. This has also been solved using Vlookup see here

Welcome to the MrExcel board!

Try this as your DV formula

=INDIRECT(CHOOSE(MATCH(B4,Data!$Q$5:$Q$12,0),"Client","Month","Product_Service","Sector","Trans_Type","Year","Year","Year"))
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,684
Members
448,977
Latest member
dbonilla0331

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