Help with data validation formula error

boim

Board Regular
Joined
Dec 14, 2009
Messages
54
Ok, I'm stumped with an error while trying to add this formula to a list type data validation:

Formula: "=IF(LEN(Prev)>0,StatusID,"")"
Prev is a Name with formula =RC[-1]
and StatusID is a Name range =dbStatus[StatusID]

This is the error in Excel: "The list source must be a delimited list, ... or column."
In VBA, it gives out Error 1004.

The strange thing is that if I add this data validation to some cells in a test workbook, it works fine.

Any thoughts?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Found what caused the problem:

Turns out the add of data validation is successful when Prev initially contains something. When content of Prev is later deleted, data validation still applies, thus the whole thing works. (The validation basically says if Prev contains something show the list of valid entry, otherwise nothing.)

However, when I tried to do this programmatically, the column where Prev refers to may have BLANKs/empty; the add fails, ergo the error.

Still, shouldn't the formula work in the first place regardless whether Prev contains something or not? Afterall the validation still works when Prev is empty after its content is deleted.

Any comments on this?
 
Upvote 0

Forum statistics

Threads
1,214,994
Messages
6,122,633
Members
449,092
Latest member
bsb1122

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