×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Conditional format based on values, characters and spaces (feet and fractional inches)

Conditional format based on values, characters and spaces (feet and fractional inches)

Conditional format based on values, characters and spaces (feet and fractional inches)

(OP)
I'm trying to foolproof a spreadsheet. I would like the user to input feet and inches in a certain format. I need a formula to use in conditional formatting that highlights a cell if the input is not correct.

It must be input as in these examples, 12'-6" or 12'-6 1/2"

The correct procedure is;
1: any number
2: the foot sign
3; a dash
4: any number
5: a space (if using a fraction)
6: the fraction (if using a fraction)
7: the inch sign

Is this even possible?
Thanks, Doug



RE: Conditional format based on values, characters and spaces (feet and fractional inches)

I don't use conditional formatting a lot, but it looks like if you write a UDF to return TRUE or FALSE depending on whether the text fits the pattern or not, then you can use that as a conditional format formula.

But have a look at this bog post regarding the need for error checking in the UDF:
http://excelmatters.com/2014/06/17/udfs-and-condit...

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

RE: Conditional format based on values, characters and spaces (feet and fractional inches)

I thnk you can format a cell so that input has to _be_ in a specific format - not jest test it. Try to look in hlp and search for "validate". Im not familiar with the function myself

RE: Conditional format based on values, characters and spaces (feet and fractional inches)

Hello,

Have tried this code on a few different entries, and it seems to work.

CODE

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then
        If Format(Target.Value, "0" & "'-" & "0") <> Target.Value Then
                MsgBox "WRONG"
                Target.ClearContents
                End
        End If
            If Format(Target.Value, "0" & "'-" & "0 0" & "/" & "0") <> Target.Value Then
                MsgBox "WRONG"
                Target.ClearContents
        End If
    End If
End Sub 

Change cell ref as required. The code needs to go into the relevant sheet code windon, not a standard module.

----------------------------------
Hope this helps.
----------------------------------

been away for quite a while
but am now back

RE: Conditional format based on values, characters and spaces (feet and fractional inches)

For the "JOB" cell, I had luck with using a custom format for the cell and using the following in the custom Type:
"JOB:" @

For the check boxes: I was able to successfully create a row that works as desired, but if I copy those boxes to other rows, they act strange like in your original sheet (when expanded, movement is not predictable and duplicate boxes are created).

RE: Conditional format based on values, characters and spaces (feet and fractional inches)

@TerryScan, wrong thread!

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close