Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CHRIS K
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

if I have the number 5 in cell a1 how can I get 1,2,3,4,6,7,8,9 to appear in
cell c1?
ie 1-9 but not 5
then if there are two numbers in a1 eg 2 and 7 I want 1,3,4,5,6,8,9 to
appear in cell c1
Any suggestions?
--
CHRISK
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

Hi

=SUBSTITUTE(SUBSTITUTE("1,2,3,4,5,6,7,8,9",A1,""), ",,",",")

But the 2nd part of your question in't so easy to answer anymore. Probably
the best solution will be an UDF.


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"CHRIS K" wrote in message
...
if I have the number 5 in cell a1 how can I get 1,2,3,4,6,7,8,9 to appear
in
cell c1?
ie 1-9 but not 5
then if there are two numbers in a1 eg 2 and 7 I want 1,3,4,5,6,8,9 to
appear in cell c1
Any suggestions?
--
CHRISK



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CHRIS K
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

What's a UDF?
--
CHRISK


"Arvi Laanemets" wrote:

Hi

=SUBSTITUTE(SUBSTITUTE("1,2,3,4,5,6,7,8,9",A1,""), ",,",",")

But the 2nd part of your question in't so easy to answer anymore. Probably
the best solution will be an UDF.


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"CHRIS K" wrote in message
...
if I have the number 5 in cell a1 how can I get 1,2,3,4,6,7,8,9 to appear
in
cell c1?
ie 1-9 but not 5
then if there are two numbers in a1 eg 2 and 7 I want 1,3,4,5,6,8,9 to
appear in cell c1
Any suggestions?
--
CHRISK




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

Hi


"CHRIS K" wrote in message
...
What's a UDF?



User Defined Function


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CHRIS K
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

HOW do you do a UDF?
--
CHRISK


"Arvi Laanemets" wrote:

Hi


"CHRIS K" wrote in message
...
What's a UDF?



User Defined Function


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

With workbook open:
press Alt+F11
InsertModule (when you don't have one)
InsertProcedure, type in the function name, set Type to Function and press
OK
A dummy function is created. Fill it with code, and close VBA editor.
When you now activate Paste Function wizard in Excel, you can find created
UDF under category User Defined.

Some rules you have to follow:
By definition a function can't change anything - it only returns a value. So
you have to avoid according statements, like Select, Activate, etc.
To return a value, you have to save it to variable with same name as
function.

An example:
Public Sub Test(TestString As String) As String
Test=TestString
End Sub


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"CHRIS K" wrote in message
...
HOW do you do a UDF?
--
CHRISK


"Arvi Laanemets" wrote:

Hi


"CHRIS K" wrote in message
...
What's a UDF?



User Defined Function


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )





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
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM
Numeric content in one cell ( implicit formula ) and the result in another one PeDevillers Excel Discussion (Misc queries) 7 March 2nd 05 07:40 AM
Transferring cell content between workbooks using cell references Kiwi Mike Excel Discussion (Misc queries) 2 November 27th 04 11:31 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 04:29 AM.

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"