Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
TMinter
 
Posts: n/a
Default Nesting 2 If functions


Hello everyone,
would really appreciate some help with this - am pulling my hair out at
the moment, and I don't have much left to pull! thx

How can I combine these 2 formulae into 1, and so that they will return
the name if it doesn't have a space or hyphen?

Cell D3 contains surnames.
I want to use this cell to create passwords in another column by either
using the whole surname or a portion of the surname if it contains
hyphens and spaces.

1st formula removes hyphens succesfully although it doesn't return the
value if false
IF(SEARCH("-", D3, 1)=1, MID(D3,1,FIND("-",D3,1)-1), D3)
2nd formula removes the space but it doesn't return the value if
valse.
IF(SEARCH(" ", D3, 1)=1, MID(D3,1,FIND(" ",D3,1)-1), D3)

e.g
D3 is Smith-Jones: Formula 1 gives me Smith
D3 is Smith Jones: Formula 2 gives me Smith
D3 is Smithjones: both formulae give me #VALUE!


--
TMinterPosted from http://www.pcreview.co.uk/ newsgroup access

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

=SUBSTITUTE(SUBSTITUTE(D3,"-","")," ","")

--
HTH

Bob Phillips

"TMinter" <TMinter.1rfu3y@ wrote in message
...

Hello everyone,
would really appreciate some help with this - am pulling my hair out at
the moment, and I don't have much left to pull! thx

How can I combine these 2 formulae into 1, and so that they will return
the name if it doesn't have a space or hyphen?

Cell D3 contains surnames.
I want to use this cell to create passwords in another column by either
using the whole surname or a portion of the surname if it contains
hyphens and spaces.

1st formula removes hyphens succesfully although it doesn't return the
value if false
IF(SEARCH("-", D3, 1)=1, MID(D3,1,FIND("-",D3,1)-1), D3)
2nd formula removes the space but it doesn't return the value if
valse.
IF(SEARCH(" ", D3, 1)=1, MID(D3,1,FIND(" ",D3,1)-1), D3)

e.g
D3 is Smith-Jones: Formula 1 gives me Smith
D3 is Smith Jones: Formula 2 gives me Smith
D3 is Smithjones: both formulae give me #VALUE!


--
TMinterPosted from http://www.pcreview.co.uk/ newsgroup access



  #3   Report Post  
bj
 
Posts: n/a
Default

try instead
=Substitute(Substitute(D3," ",""),"-","")

"TMinter" wrote:


Hello everyone,
would really appreciate some help with this - am pulling my hair out at
the moment, and I don't have much left to pull! thx

How can I combine these 2 formulae into 1, and so that they will return
the name if it doesn't have a space or hyphen?

Cell D3 contains surnames.
I want to use this cell to create passwords in another column by either
using the whole surname or a portion of the surname if it contains
hyphens and spaces.

1st formula removes hyphens succesfully although it doesn't return the
value if false
IF(SEARCH("-", D3, 1)=1, MID(D3,1,FIND("-",D3,1)-1), D3)
2nd formula removes the space but it doesn't return the value if
valse.
IF(SEARCH(" ", D3, 1)=1, MID(D3,1,FIND(" ",D3,1)-1), D3)

e.g
D3 is Smith-Jones: Formula 1 gives me Smith
D3 is Smith Jones: Formula 2 gives me Smith
D3 is Smithjones: both formulae give me #VALUE!


--
TMinterPosted from http://www.pcreview.co.uk/ newsgroup access


  #4   Report Post  
TMinter
 
Posts: n/a
Default


Perfect! A very neat solution.

thank you


--
TMinterPosted from http://www.pcreview.co.uk/ newsgroup access

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
Nesting functions in the functions dialog box cs170a Excel Worksheet Functions 0 June 10th 05 10:36 PM
nesting functions Gary Brown Excel Worksheet Functions 0 May 31st 05 11:32 PM
Nesting Functions LostNFound Excel Worksheet Functions 4 March 3rd 05 09:59 PM
What is the syntax for nesting functions such as IF AND? Lane CC Laura Excel Worksheet Functions 1 February 11th 05 03:07 AM
nesting 18 x functions Jenny Excel Worksheet Functions 3 December 2nd 04 12:01 PM


All times are GMT +1. The time now is 12:34 PM.

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

About Us

"It's about Microsoft Excel"