Solved

remove used item(s) from validation list

Posted on 2011-02-17
11
358 Views
Last Modified: 2012-05-11
I am trying to apply a validation list (inevitably from another sheet!) but as I go down the column I need the list to contract and discount the items which I have just used higher up the column. Excel Hacks (O'Reilly) - a book I rate - has some code for this but it does nothing - the validation is applied by =NamedRange but it does not seem to contract. I can post the code from the O'Reilly website if that would help. Intriguingly the debug routing does nothing either - not an hint of yellow
0
Comment
Question by:Pitfour
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 45

Expert Comment

by:patrickab
ID: 34921906
Pitfour,

Please upload your file so that we can work with data that is significant for you.

Patrick
0
 
LVL 50
ID: 34921973
Hello,

this can be done without any VBA. Debrah Dalgliesh has a tutorial on the contextures.com site: http://www.contextures.com/xlDataVal03.html

I've used this successfully in many situations. Not a line of VBA required. If you need help setting this up, please post a sample workbook.

cheers, teylyn
0
 

Author Comment

by:Pitfour
ID: 34922318
Teylyn and Patrickab

I have tried the contextures proposal  - no dice. I have attached a piece of data. I would rather do it in code - the ssheet needs to be used by ...others.
ValidList-trial.xls
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 50
ID: 34922382
Hello,

see attached the formula version in place.

cheers, teylyn
Copy-of-ValidList-trial.xls
0
 
LVL 50
ID: 34922389
By the way, you can hide Sheet1 and/or protect it against accidental changes from  "...others" by protecting it with a password after it has been set up.

cheers,
0
 

Author Comment

by:Pitfour
ID: 34922564
Works really well but briefly: pse can you outline the changes to be made when I add another 10 names to the list and the avail codes are 600 or so.

Thanks
0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 250 total points
ID: 34922639
Hello,

see attached file set up for 600 rows of codes in Sheet1 and up to 500 rows of data in Sheet2

The amended formulas are in Sheet1:

B1 =IF(COUNTIF(Sheet2!$B$1:$B$500,A1)>=1,"",ROW())  -- no change to previous version
C1 =IF(ROW(A1)-ROW(A$1)+1>COUNT(B$1:B$600),"",INDEX(A:A,SMALL(B$1:B$600,1+ROW(A1)-ROW(A$1))))  -- changed $B$13 to $B$600 in two places

Named range "NetList" refers to

=OFFSET(Sheet1!$C$1,0,0,COUNTA(Sheet1!$C$1:$C$600)-COUNTBLANK(Sheet1!$C$1:$C$600),1)  -- changed $C$13 to $C$600 in two places

If your list of codes gets longer than 600, you just need to set the C1 formula (remember to copy down!!) and the named range and adjust 600 to exactly the number of codes you have.

cheers, teylyn
Copy-of-ValidList-trial.xls
0
 

Author Comment

by:Pitfour
ID: 34924023
Ah, this works absolutely as intended, thank you. I am still perplexed by the OFFSET but it definitely ...works!!

Thanks for all your help

Robin, London
0
 
LVL 50
ID: 34924175
Thanks. The Offset() looks daunting because of the nested CountA() and CountBlank(). Pluck it apart and it becomes easier

Offset syntax:

Offset(startRange, rows, columns, height, width)

=COUNTA(C1:C600) returns 600
=COUNTBLANK(C1:C600) returns the number of blank cells in the range, let's say 5

so

Offset(C1, 0 rows, 0 columns, 600-5 rows high, 1 column wide)

Thinking about this, you could also use the count of numbers in column B with Count(). This would not count the cells with no number and the Offset() will look a little shorter:

=OFFSET(Sheet1!$C$1,0,0,COUNT(Sheet1!$B$1:$B$600),1)

cheers, teylyn

0
 
LVL 45

Expert Comment

by:patrickab
ID: 34924446
Pitfour,

If you can accept blanks in the Data Validation list then the formula for the cells in the named range can be much simpler:

=IF((COUNTIF($A$1:$A$7,A1)+COUNTIF(Sheet1!$A$1:$A$10,Sheet2!A1))>1,"",Sheet2!A1)

and copied down to the end of the data. It's in the attached file.

Patrick
DV-reducing-list-01.xls
0
 
LVL 50
ID: 34925218
Be aware that blanks in a data validation list mean that ANY value can be entered into the cell. If you simply type a value, it will be accepted if the validation list contains blanks.

Cheers, teylyn
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question