Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-04-2009, 06:23 AM
zbor's Avatar
zbor zbor is online now
Valued Forum Contributor
 
Join Date: 10 Feb 2009
Location: Croatia
MS Office Version:Excel 2007
Posts: 2,533
zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability
Send a message via MSN to zbor
If cell has x turn into number and concatenate

Please Register to Remove these Ads

Example is in the attch:

Book11.xls

This formula works but if there is no number 4 then I don't want comma after 1, or 2, or 3,

How avoid it:

results

1,2,3,4
1,2,
1,2,3,
3,4
1,
4
2,3,

(red , need to be removed)
__________________
"Relax. What is mind? No matter. What is matter? Never mind!"

Last edited by zbor; 07-04-2009 at 07:28 AM.
Reply With Quote
  #2  
Old 07-04-2009, 06:26 AM
zbor's Avatar
zbor zbor is online now
Valued Forum Contributor
 
Join Date: 10 Feb 2009
Location: Croatia
MS Office Version:Excel 2007
Posts: 2,533
zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability
Send a message via MSN to zbor
Re: If cell has x turn into number and concatenate

Of course, you can change formula at will.
__________________
"Relax. What is mind? No matter. What is matter? Never mind!"
Reply With Quote
  #3  
Old 07-04-2009, 06:30 AM
martindwilson's Avatar
martindwilson martindwilson is offline
Forum Guru
 
Join Date: 23 Jun 2007
Location: London,England
MS Office Version:office 97 ,2003 ,2007
Posts: 6,084
martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding
Re: If cell has x turn into number and concatenate

take the , out of the formula?
oh i see you want 1,2 and 1,2,3
but no trailing ,
=LEFT(IF(A2="x","1,","")&IF(B2="x","2,","")&IF(C2="x","3,","")&IF(D2="x","4,",""),LEN(IF(A2="x","1," ,"")&IF(B2="x","2,","")&IF(C2="x","3,","")&IF(D2="x","4,",""))-1)
there must be a shorter way tho.
__________________
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code

how to enter array formula


recommended reading
wiki Mojito

how to say no convincingly

most important think you need

Last edited by martindwilson; 07-04-2009 at 06:38 AM.
Reply With Quote
  #4  
Old 07-04-2009, 06:30 AM
zbor's Avatar
zbor zbor is online now
Valued Forum Contributor
 
Join Date: 10 Feb 2009
Location: Croatia
MS Office Version:Excel 2007
Posts: 2,533
zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability
Send a message via MSN to zbor
Re: If cell has x turn into number and concatenate

Just after last number
__________________
"Relax. What is mind? No matter. What is matter? Never mind!"
Reply With Quote
  #5  
Old 07-04-2009, 06:43 AM
martindwilson's Avatar
martindwilson martindwilson is offline
Forum Guru
 
Join Date: 23 Jun 2007
Location: London,England
MS Office Version:office 97 ,2003 ,2007
Posts: 6,084
martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding
Re: If cell has x turn into number and concatenate

there you go, add , after every number then remove last character
__________________
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code

how to enter array formula


recommended reading
wiki Mojito

how to say no convincingly

most important think you need
Reply With Quote
  #6  
Old 07-04-2009, 07:28 AM
zbor's Avatar
zbor zbor is online now
Valued Forum Contributor
 
Join Date: 10 Feb 2009
Location: Croatia
MS Office Version:Excel 2007
Posts: 2,533
zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability zbor is very confident of their ability
Send a message via MSN to zbor
Re: If cell has x turn into number and concatenate

I figure it out during lunch

=LEFT(IF(A3="x";"1,";"")&IF(B3="x";"2,";"")&IF(C3="x";"3,";"")&IF(D3="x";"4";"");2*COUNTA(A3:D3)-1)
__________________
"Relax. What is mind? No matter. What is matter? Never mind!"
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump