Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Choose items from a list and add to a string in a cell

Hello

I have Excel Spreadsheet, with the following columns containing a list of
our office with an office code. ':' is the column seperator here

Code:Office:Selected?
LEI:Leicester:Y
NOT:Nottingham:N
SHF:Sheffield:N
DON:Doncaster:Y
MAN:Manchester:N
BHM:Birmingham:Y

On a seperate sheet, I have a box that I want to populate with a list of
office codes, seperated by a comma, which has a 'Y' in the selected column.

So, in the example above, this box on the seperate sheet would show as

Offices Selected: LEI, DON, BHM

I'm thinking a CONCATENATE string, but can't work out how to do a look up
the column and identify the code in column A if column C=y...


Can anyone help please?

Thanks

Ben



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Choose items from a list and add to a string in a cell

Ben,
Any Lookup function you use is going to stop looking at the first match it
finds, so if you just look in column C for a 'Y', it will always find the
first one, and none after that. You're going to have to examine all rows for
very specific results. Assuming your data is all that there is, and that the
sheet the list is on is named Sheet1 and the data is in cells A2:C7 then this
formula on another sheet would give you what you want. It performs a
specific VLOOKUP() for each opssible Code on Sheet1 and if the Selected?
entry is Y, then it just forces that code to appear and it concatenates all
of the results.

Note that if any of the codes (SHF, MAN, etc. are not in the list, that
causes an #N/A error within the formula, which causes the entire formula to
return #N/A. Here's the basic formula:

=IF(VLOOKUP("LEI",Sheet1!$A$2:$C$7,3,FALSE)="Y","L EI ","") &
IF(VLOOKUP("NOT",Sheet1!$A$2:$C$7,3,FALSE)="Y","NO T ","") &
IF(VLOOKUP("SHF",Sheet1!$A$2:$C$7,3,FALSE)="Y","SH F ","") &
IF(VLOOKUP("DON",Sheet1!$A$2:$C$7,3,FALSE)="Y","DO N ","") &
IF(VLOOKUP("MAN",Sheet1!$A$2:$C$7,3,FALSE)="Y","MA N","") &
IF(VLOOKUP("BHM",Sheet1!$A$2:$C$7,3,FALSE)="Y","BH M ","")



"Ben" wrote:

Hello

I have Excel Spreadsheet, with the following columns containing a list of
our office with an office code. ':' is the column seperator here

Code:Office:Selected?
LEI:Leicester:Y
NOT:Nottingham:N
SHF:Sheffield:N
DON:Doncaster:Y
MAN:Manchester:N
BHM:Birmingham:Y

On a seperate sheet, I have a box that I want to populate with a list of
office codes, seperated by a comma, which has a 'Y' in the selected column.

So, in the example above, this box on the seperate sheet would show as

Offices Selected: LEI, DON, BHM

I'm thinking a CONCATENATE string, but can't work out how to do a look up
the column and identify the code in column A if column C=y...


Can anyone help please?

Thanks

Ben



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Choose items from a list and add to a string in a cell

This will work for your sample data:

=IF(Sheet1!C2="Y",Sheet1!A2&", ","")&IF(Sheet1!C3="Y",Sheet1!A3&",
","")&IF(Sheet1!C4="Y",Sheet1!A4&", ","")&IF(Sheet1!C5="Y",Sheet1!
A5&", ","")&IF(Sheet1!C6="Y",Sheet1!A6&", ","")&IF(Sheet1!
C7="Y",Sheet1!A7&", ","")

assuming it is on Sheet1 and occupies A1:C7.

Hope this helps.

Pete

On Jul 21, 7:19*pm, Ben wrote:
Hello

I have Excel Spreadsheet, with the following columns containing a list of
our office with an office code. *':' is the column seperator here

Code:Office:Selected?
LEI:Leicester:Y
NOT:Nottingham:N
SHF:Sheffield:N
DON:Doncaster:Y
MAN:Manchester:N
BHM:Birmingham:Y

On a seperate sheet, I have a box that I want to populate with a list of
office codes, seperated by a comma, which has a 'Y' in the selected column.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
search if a string contains text matching items in a list neil Excel Worksheet Functions 3 March 11th 08 09:13 PM
How do I choose multiple items from a drop down box? Lisa Pearl Excel Worksheet Functions 3 September 22nd 06 03:20 PM
can excel choose a name from a list when I am typing in a cell madisonville Excel Worksheet Functions 1 June 28th 06 03:28 AM
choose a particular word in a string Tim Excel Discussion (Misc queries) 4 May 24th 06 07:15 AM
How do I compare two lists and choose the items that are in both? laurabailey8 Excel Worksheet Functions 0 January 3rd 06 11:31 PM


All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"