Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Help with function

Hey Guys and Gals,

I need a little help with a function. I need to evaluate a cell and
determine if the 12 character is a "-" (dash). And if it is a dash I
need to strip it and if its not a dash I need to leave it alone. By
the way the 12th character is the last character so its 12th from the
left or 1st from the right. Seems to me I need to somehow nest a
certain function inside an IF function. Please help.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Help with function

Try this:

=LEFT(A1,12-(MID(A1,12,1)="-"))
OR
=LEFT(A1,12-(RIGHT(A1,1)="-"))

Does that help?
----------------------
Regards,

Ron
Microsoft MVP (Excel)



"Computer geek" wrote in message
oups.com...
Hey Guys and Gals,

I need a little help with a function. I need to evaluate a cell and
determine if the 12 character is a "-" (dash). And if it is a dash I
need to strip it and if its not a dash I need to leave it alone. By
the way the 12th character is the last character so its 12th from the
left or 1st from the right. Seems to me I need to somehow nest a
certain function inside an IF function. Please help.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Help with function

On Jun 7, 12:08 pm, "Ron Coderre"
wrote:
Try this:

=LEFT(A1,12-(MID(A1,12,1)="-"))
OR
=LEFT(A1,12-(RIGHT(A1,1)="-"))

Does that help?
----------------------
Regards,

Ron
Microsoft MVP (Excel)

"Computer geek" wrote in message

oups.com...



Hey Guys and Gals,


I need a little help with a function. I need to evaluate a cell and
determine if the 12 character is a "-" (dash). And if it is a dash I
need to strip it and if its not a dash I need to leave it alone. By
the way the 12th character is the last character so its 12th from the
left or 1st from the right. Seems to me I need to somehow nest a
certain function inside an IF function. Please help.- Hide quoted text -


- Show quoted text -


WOW thanks... I used the first one and it worked great. I still dont
understand how it worked though. I'm getting stumped on the 12-mid()

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Help with function

I'm glad that helped.


Regarding: 12-(MID(A1,12,1)="-")

This part returns the 12th character: MID(A1,12,1)

This part test if the 12 character is a dash (-): (MID(A1,12,1)="-")
The possible return values are TRUE and FALSE.

In Excel, when an arithmetic operator is applied to a boolean value
(TRUE/FALSE), TRUE becomes 1 and FALSE becomes zero.

Consequently,
if the 12th char is a dash....12-1...which equals 11
otherwise.....................12-0

I hope that helps.
----------------------
Regards,

Ron
Microsoft MVP (Excel)



"Computer geek" wrote in message
oups.com...
On Jun 7, 12:08 pm, "Ron Coderre"
wrote:
Try this:

=LEFT(A1,12-(MID(A1,12,1)="-"))
OR
=LEFT(A1,12-(RIGHT(A1,1)="-"))

Does that help?
----------------------
Regards,

Ron
Microsoft MVP (Excel)

"Computer geek" wrote in message

oups.com...



Hey Guys and Gals,


I need a little help with a function. I need to evaluate a cell and
determine if the 12 character is a "-" (dash). And if it is a dash I
need to strip it and if its not a dash I need to leave it alone. By
the way the 12th character is the last character so its 12th from the
left or 1st from the right. Seems to me I need to somehow nest a
certain function inside an IF function. Please help.- Hide quoted
text -


- Show quoted text -


WOW thanks... I used the first one and it worked great. I still dont
understand how it worked though. I'm getting stumped on the 12-mid()



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Help with function

The MID or RIGHT functions when compared with "-" will return TRUE if the
relevant character is a dash, or FALSE if it isn't.
TRUE and FALSE are evaluated as 1 or 0 respectively, so the LEFT function
takes 12 letters if it doesn't end with a dash, or 11 letters (=12-TRUE,
=12-1) if the dash is to be removed.
Easy when you know how.
--
David Biddulph

"Computer geek" wrote in message
oups.com...

WOW thanks... I used the first one and it worked great. I still dont
understand how it worked though. I'm getting stumped on the 12-mid()


On Jun 7, 12:08 pm, "Ron Coderre"
wrote:
Try this:

=LEFT(A1,12-(MID(A1,12,1)="-"))
OR
=LEFT(A1,12-(RIGHT(A1,1)="-"))

Does that help?
----------------------
Regards,

Ron
Microsoft MVP (Excel)

"Computer geek" wrote in message

oups.com...

Hey Guys and Gals,


I need a little help with a function. I need to evaluate a cell and
determine if the 12 character is a "-" (dash). And if it is a dash I
need to strip it and if its not a dash I need to leave it alone. By
the way the 12th character is the last character so its 12th from the
left or 1st from the right. Seems to me I need to somehow nest a
certain function inside an IF function. Please help.- Hide quoted
text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Help with function

On Jun 7, 12:55 pm, "Ron Coderre"
wrote:
I'm glad that helped.

Regarding: 12-(MID(A1,12,1)="-")

This part returns the 12th character: MID(A1,12,1)

This part test if the 12 character is a dash (-): (MID(A1,12,1)="-")
The possible return values are TRUE and FALSE.

In Excel, when an arithmetic operator is applied to a boolean value
(TRUE/FALSE), TRUE becomes 1 and FALSE becomes zero.

Consequently,
if the 12th char is a dash....12-1...which equals 11
otherwise.....................12-0

I hope that helps.
----------------------
Regards,

Ron
Microsoft MVP (Excel)

"Computer geek" wrote in message

oups.com...



On Jun 7, 12:08 pm, "Ron Coderre"
wrote:
Try this:


=LEFT(A1,12-(MID(A1,12,1)="-"))
OR
=LEFT(A1,12-(RIGHT(A1,1)="-"))


Does that help?
----------------------
Regards,


Ron
Microsoft MVP (Excel)


"Computer geek" wrote in message


groups.com...


Hey Guys and Gals,


I need a little help with a function. I need to evaluate a cell and
determine if the 12 character is a "-" (dash). And if it is a dash I
need to strip it and if its not a dash I need to leave it alone. By
the way the 12th character is the last character so its 12th from the
left or 1st from the right. Seems to me I need to somehow nest a
certain function inside an IF function. Please help.- Hide quoted
text -


- Show quoted text -


WOW thanks... I used the first one and it worked great. I still dont
understand how it worked though. I'm getting stumped on the 12-mid()- Hide quoted text -


- Show quoted text -


OK I get it now. I didn't know about the True becomes 1 and False
becomes 0

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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
SUMIF Function Inside SUMPRODUCT Function Abdul Waheed Excel Worksheet Functions 17 September 19th 05 04:24 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM
Nested IF Function, Date Comparing, and NetworkDays Function carl Excel Worksheet Functions 2 December 29th 04 09:57 PM


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

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"