Rick,
In any cell (we'll use B1 for this example) enter your IF statement and have it return the range of cells as a text value. So, for your example it would be, =IF(E12="lamp","A1:A120","A1:A140"). Then, for your data validation list formula, refer to the cell with your IF statement like this:
=INDIRECT(B1)
That should work.
-Ben
Ben & Rick,
You can avoid that extra step of processing that INDIRECT incurs. Moreover, INDIRECT is a volatile function you should not use unless absolutely necessary. So I'd suggest using directly as source formula in Data Validation:
=IF(E12="lamp",A1:A120,A1:A140)
Aladin
Aladin:
Thank will only work if the list is in the same sheet. In my case the list is in another sheet.
Thanks. Ben & Rick, You can avoid that extra step of processing that INDIRECT incurs. Moreover, INDIRECT is a volatile function you should not use unless absolutely necessary. So I'd suggest using directly as source formula in Data Validation: =IF(E12="lamp",A1:A120,A1:A140) Aladin
Rick,
That should not be a problem if the sheets are in the same workbook. just prefix the range with the name of the sheet in which it is contained as in =IF(E2="lamp",Sheet2!A1:A9,Sheet3:B10:B15. Also, you can name them say SourceA and SourceB and use these names in the IF-formula instead.
Aladin