HOW DO I WRITE A STRING TO FLAG WHEN A CELL HAS OR 17 CHARACTERS?

HOW DO I WRITE A STRING TO FLAG WHEN A CELL HAS < OR > 17 CHARACTERS?

Hi Tassytiger,
A "string" is just a string of characters. Examples are qwerty, 123abc, 43πbono. there are several ways to write one. A more precise description of your end goal might help answer "How do I write a string."
To the current version of your specific question:
What I actually need to achieve is a situation where, when I enter <17 Char. or >17 Char.
inadvertently then tab to the next cell, I get the following response in the active cell:
The cell immediately below "17 character ID" displays an error triangle. These are shown when the formula in a cell produces an error message. they are system generated and require two things to happen: The cell must contain a formula AND something must have happened to cause that formula to produce an error.
I don't wish to add any columns to my s/s but would like to apply the rule to the current column just as i would change the text or fill colour.
The difficulty there is that a cell may contain entered data, OR it may contain a formula. You want to enter data (a string of characters) and you want to produce an error triangle if that string has more or fewer than 17 characters. Evaluating the length of the string requires a formula. Getting the string into the cell requires direct entry (in your scenario). The two are not compatible within the content of a single cell.
Terry's example uses a formula in column B to measure the length of the string in column A. If the length is 17 characters, the IF statement produces the empty string ( "" ), and the cell in column B appears empty. If the string is not 17 characters long, the IF statement produces the string "Not 17 Chars!"
His formula is easily changed to produce an error triangle in place of "Not 17 Chars!":
B1: =IF(LEN(A1)=17, "",17/0)
In this version, if the length of the string in A1 is not 17 (characters), the formula will attempt to divide 17 by 0, and will produce a 'division by zero' error.
But, as with all of the other suggestions, this one will require a new column to provide space for the formula and it's result.
Changing the text or fill colour can be done using conditional formatting. Changing content of the cell (eg. choosing between the entered string of characters and the error triangle) cannot.
Conditional formatting rules compare the content of a the cell to be formatted with either a fixed value (written into the rule) or to the content of another cell. In my examples (and in Ian's examples) above the rules compared the content of the cell to be formattes to the number '17'. The number was generated by a formula which measured the length (in characters) of the text in the cell where the ID was entered, and reported that length as a number.
A way to show a red triangle using conditional formatting is to use Image fill as the default fill of the cell, then use a colour fill as the conditional fill to hide the trialngle when the conditions are met. Here's the same example as used above, with this technique applied to column B:
The same formula is used in column B as in my previous example. Type size is set to 1 point (note the black dot, visible in the green filled cell) to keep the numbers from obscuring the triangles. The triangles are shapes, inserted onto the canvas (not into the table) from the Shapes button in the tools. Their fill colour has been changed to red, a 12 point exclamation sign character ha been typed into the shape and its text colour set to white, and the triangle's size has been reduced as much as possible without triggering the overflow symbol (boxed plus sigh) to appear.
The triangle image (and some of its white background) was made into a png image file by taking a screen shot, and the image was inserted into all of the cells in the body rows of column B as an image fill, using the Graphic inspector. The conditional format rule below was then applied to the body row cells in column B.
Finally, you can apply conditional formatting to the cell containing the ID. This will still require another column to contain the values to which the content of the ID cell will be compared, but that column may be hidden, or may be located on a separate table.
The method requires an second cell for each cell contining an ID, and uses a formula that makes the contents of the second cell the same as that of the ID cell IF the ID cell contents are 17 characters long.
Here's a sample. Table 1 is column A of the same table as above. Table 2 is a single column table holding the comparison cells.
As in the example above, the cells on table 1 were given an image fill. The conditional format rule replaces that with a white colour fill when the cell contains the same text as its partner cell in Table 2.
This is the rule for cell A2. In A3, the cell reference is to Table 2::A3, and in A4, to Table 2::A4. The cell references in conditional format rules must be edited individually.
Regards,
Barry

Similar Messages

  • How can i write a string into a specified pos of a file?

    How can i write a string into a specified pos of a file without read all file into ram and write the whole file again?
    for example:
    the content of file is:
    name=123
    state=456
    i want to modify the value of name with 789
    (write to file without read all file into ram)
    How can i do it? thank you

    take this as an idea. it actually does what i decribed above. you sure need to make some modifications so it works for your special need. If you use it and add any valuable code to it or find any bugs, please let me know.
    import java.io.*;
    import java.util.*;
    * Copyright (c) 2002 Frank Fischer <[email protected]>
    * All rights reserved. See the LICENSE for usage conditions
    * ObjectProperties.java
    * version 1.0, 2002-09-12
    * author Frank Fischer <[email protected]>
    public class ObjectProperties
         // the seperator between the param-name and the value in the prooperties file
         private static final String separator = "=";
         // the vector where we put the arrays in
         private Vector PropertiesSet;
         // the array where we put the param/value pairs in
         private String propvaluepair[][];
         // the name of the object the properties file is for
         public String ObjectPropertiesFileName;
         // the path to the object'a properties file
         public String ObjectPropertiesDir;
         // reference to the properties file
         public File PropertiesFile;
         // sign for linebreak - depends on platforms
         public static final String newline = System.getProperty("line.separator");
         public ObjectProperties(String ObjectPropertiesFileName, String ObjectPropertiesDir, ObjectPropertiesManager ObjectPropertiesManager)
         //     System.out.println("Properties Objekt wird erzeugt: "+ObjectPropertiesFileName);
              this.ObjectPropertiesFileName = ObjectPropertiesFileName;
              this.ObjectPropertiesDir = ObjectPropertiesDir;
              // reference to the properties file
              PropertiesFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
              // vector to put the param/value pair-array in
              PropertiesSet = new Vector();
         //     System.out.println("Properties File Backup wird erzeugt: "+name);
              backup();
         //     System.out.println("Properties File wird eingelesen: "+PropertiesFile);
              try
                   //opening stream to file for read operations
                   FileInputStream FileInput = new FileInputStream(PropertiesFile);
                   DataInputStream DataInput = new DataInputStream(FileInput);
                   String line = "";
                   //reading line after line of the properties file
                   while ((line = DataInput.readLine()) != null)
                        //just making sure there are no whitespaces at the beginng or end of the line
                        line = cutSpaces(line);
                        if (line.length() > 0)
                             //$ indicates a param-name
                             if (line.startsWith("$"))
                                  // array to store a param/value pair in
                                  propvaluepair = new String[1][2];
                                  //get the param-name
                                  String parameter = line.substring(1, line.indexOf(separator)-1);
                                  //just making sure there are no whitespaces at the beginng or end of the variable
                                  parameter = cutSpaces(parameter);
                                  //get the value
                                  String value = line.substring(line.indexOf(separator)+1, line.length());
                                  //just making sure there are no whitespaces at the beginng or end of the variable
                                  value = cutSpaces(value);
                                  //put the param-name and the value into an array
                                  propvaluepair[0][0] = parameter;
                                  propvaluepair[0][1] = value;
                             //     System.out.println("["+ObjectPropertiesFileName+"] key/value gefunden:"+parameter+";"+value);
                                  //and finaly put the array into the vector
                                  PropertiesSet.addElement(propvaluepair);
              // error handlig
              catch (IOException e)
                   System.out.println("ERROR occured while reading property file for: "+ObjectPropertiesFileName);
                   System.out.println("ERROR CODE: "+e);
                   // System.out.println("in ObjectProperties");
         // function to be called to get the value of a specific paramater 'param'
         // if the specific paramater is not found '-1' is returned to indicate that case
         public String getParam(String param)
              // the return value indicating that the param we are searching for is not found
              String v = "-1";
              // looking up the whole Vector
              for (int i=0; i<PropertiesSet.size(); i++)
                   //the String i want to read the values in again
                   String s[][] = new String[1][2];
                   // trying to get out the array from the vector again
                   s = (String[][]) PropertiesSet.elementAt(i);
                   // comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
                   if (s[0][0].equals(param) == true)
                        //if the param-names are the same, we look up the value and write it in the return variable
                        v = s[0][1];
                        // making sure the for loop ends
                        i = PropertiesSet.size();
              // giving the value back to the calling procedure
              return v;
         // function to be called to set the value of a specific paramater 'param'
         public void setParam(String param, String value)
              // looking up the whole Vector for the specific param if existing or not
              for (int i=0; i<PropertiesSet.size(); i++)
                   //the String i want to read the values in again
                   String s[][] = (String[][]) PropertiesSet.elementAt(i);
                   // comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
                   if (s[0][0].equals(param) == true)
                        //if the param-names are the same, we remove the param/value pair so we can add the new pair later in
                        PropertiesSet.removeElementAt(i);
                        // making sure the for loop ends
                        i = PropertiesSet.size();
              // if we land here, there is no such param in the Vector, either there was none form the beginng
              // or there was one but we took it out.
              // create a string array to place the param/value pair in
              String n[][] = new String[1][2];
              // add the param/value par
              n[0][0] = param;
              n[0][1] = value;
              // add the string array to the vector
              PropertiesSet.addElement(n);
         // function to save all data in the Vector to the properties file
         // must be done because properties might be changing while runtime
         // and changes are just hold in memory while runntime
         public void store()
              backup();
              String outtofile = "# file created/modified on "+createDate("-")+" "+createTime("-")+newline+newline;
              try
                   //opening stream to file for write operations
                   FileOutputStream PropertiesFileOuput = new FileOutputStream(PropertiesFile);
                   DataOutputStream PropertiesDataOutput = new DataOutputStream(PropertiesFileOuput);
                   // looping over all param/value pairs in the vector
                   for (int i=0; i<PropertiesSet.size(); i++)
                        //the String i want to read the values in
                        String s[][] = new String[1][2];
                        // trying to get out the array from the vector again
                        s = (String[][]) PropertiesSet.elementAt(i);
                        String param = "$"+s[0][0];
                        String value = s[0][1];
                        outtofile += param+" = "+value+newline;
                   outtofile += newline+"#end of file"+newline;
                   try
                        PropertiesDataOutput.writeBytes(outtofile);
                   catch (IOException e)
                        System.out.println("ERROR while writing to Properties File: "+e);
              catch (IOException e)
                   System.out.println("ERROR occured while writing to the property file for: "+ObjectPropertiesFileName);
                   System.out.println("ERROR CODE: "+e);
         // sometimes before overwritting old value it's a good idea to backup old values
         public void backup()
              try
                   // reference to the original properties file
                   File OriginalFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
                   File BackupFile = new File(ObjectPropertiesDir+"/backup/"+ObjectPropertiesFileName+".backup");
                   //opening stream to original file for read operations
                   FileInputStream OriginalFileInput = new FileInputStream(OriginalFile);
                   DataInputStream OriginalFileDataInput = new DataInputStream(OriginalFileInput);
                   //opening stream to backup file for write operations
                   FileOutputStream BackupFileOutput = new FileOutputStream(BackupFile);
                   DataOutputStream BackupFileDataOutput = new DataOutputStream(BackupFileOutput);
              //     String content = "";
                   String line = "";
                   // do till end of file
                   while ((line = OriginalFileDataInput.readLine()) != null)
                        BackupFileDataOutput.writeBytes(line+newline);
              // error handlig
              catch (IOException e)
                   System.out.println("ERROR occured while back up for property file: "+ObjectPropertiesFileName);
                   System.out.println("ERROR CODE: "+e);
                   System.out.println("this is a serious error - the server must be stopped");
         private String cutSpaces(String s)
              while (s.startsWith(" "))
                   s = s.substring(1, s.length());
              while (s.endsWith(" "))
                   s = s.substring(0, s.length()-1);
              return s;
         public String createDate(String seperator)
              Date datum = new Date();
              String currentdatum = new String();
              int year, month, date;
              year = datum.getYear()+1900;
              month = datum.getMonth()+1;
              date = datum.getDate();
              currentdatum = ""+year+seperator;
              if (month < 10)
                   currentdatum = currentdatum+"0"+month+seperator;
              else
                   currentdatum = currentdatum+month+seperator;
              if (date < 10)
                   currentdatum = currentdatum+"0"+date;
              else
                   currentdatum = currentdatum+date;
              return currentdatum;
         public String createTime(String seperator)
              Date time = new Date();
              String currenttime = new String();
              int hours, minutes, seconds;
              hours = time.getHours();
              minutes = time.getMinutes();
              seconds = time.getSeconds();
              if (hours < 10)
                   currenttime = currenttime+"0"+hours+seperator;
              else
                   currenttime = currenttime+hours+seperator;
              if (minutes < 10)
                   currenttime = currenttime+"0"+minutes+seperator;
              else
                   currenttime = currenttime+minutes+seperator;
              if (seconds < 10)
                   currenttime = currenttime+"0"+seconds;
              else
                   currenttime = currenttime+seconds;
              return currenttime;

  • How can I write a code that triggers when clicking on Save button

    I want to hide certain fields inside my tracking list, if the login user is not part of the “Managers” group.
    To do so I want to add the following Page-load code inside a web part :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    {SPGroup group = site.Groups["Managers"];
    bool isUser = site.IsCurrentUserMemberOfGroup(group.ID);
    if (isUser)
    {textbox.Visible=false;}}
    And the following custom code that triggers when saving the form :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    SPList list = web.Lists["ListName"];web.AllowUnsafeUpdates = true;
    SPListItem item = list.Items[SPContext.Current.ListItem.UniqueId];
    txtTitle.Text = item["Title"] as string;item.Update();web.AllowUnsafeUpdates = false;
    But I am not sure where exactly I should add the custom code for the save button ? I tried writing it inside the Oninit method , but I got many errors as shown below:-
    So can anyone advice how i should write the web part to include the Page load & the custom save button code?
    second question in general is my above approach considered valid , i mean to hide/show list columns using web parts ?

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How do you write a string of UTF-8 that's an image to a folder

    I have something like this
    ?PNG
    �?�?}?�?soo&#65533;{]o?��z&#65533;F?�?�a�51>dc�A�&?E??<�??g?+???n%?�??z&#65533;���Ou/?0?�[??Zq?�sZ??�]?
    that is a UTF-8 string and I want to write it to a folder so I can cache the image for later use. How do I do this?

    2dor wrote:
    I have something like this
    ?PNG
    �?�?}?&#131;?soo&#65533;{]o?��z&#65533;F?&#147;?&#139;a�51>dc&#132;A�&?E??<&#149;??g?+???n%?&#149;??z&#65533;&#153;��Ou/?0?&#145;[??Zq?�sZ??&#159;]?
    that is a UTF-8 string and I want to write it to a folder so I can cache the image for later use. How do I do this?It's almost certainly NOT a UTF-8 string, it's binary that cannot be safely represented as a String. Image data is not string-able. Read it in as bytes, write it out as bytes, and you should be good to go.
    For specifics on creating and writing to "folders", look at java.io.File and friends. Pay attention to File.mkdir(), for example.
    Grant

  • How can I write this string to a file as the ASCII representation in Hex format?

    I need to convert a number ( say 16000 ) to Hex string ( say 803E = 16,000) and send it using Visa Serial with the string control in Hex Mode. I have no problem with the conversion (see attached). My full command in the hex display must read AA00 2380 3E...
    I can easily get the string together when in Normal mode to read AA0023803E... but how can I get this to hex mode without converting? (i.e. 4141 3030 3233 3830 3345 3030 3030 3031 )
    Attachments:
    volt to HEX.vi ‏32 KB

    Sorry, The little endian option was probably introduced in 8.0 (?).
    In this special case it's simple, just reverse the string before concatenating with the rest.
    It should be in the string palette, probably under "additional string functions".
    (note that this only works in this special case flattening a single number as we do here. If the stat structure is more complex (array, cluster, etc.) you would need to do a bit more work.
    Actually, you might just use typecast as follows. Same difference.
    I only used the flatten operation because of the little endian option in my version.
    Message Edited by altenbach on 11-16-2007 11:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    littleendian71.png ‏4 KB
    littleEndiancast71.png ‏4 KB

  • How to get an xml string into a Document w/o escaping mark-up characters?

    Hi,
    I am using one of the latest xerces using Java. I am pretty sure I am using xerces-2.
    I have an existing Document and I am trying to add more content to it. The new content itself is xml string. I am trying to insert this xml string into the document using document.createTextNode. I am able to insert, but somewhere it is escaping the mark-up characters (<,>,etc). When I convert the document into String, I can see, for example, <userData> instead of <userData>.
    There is an alternative option to accomplish this by creating a new document with this xml string, get the root element, import this element into my document. Execution time for this procedure is very high - means, this is very bad in terms of time-wise performance.
    Can any help on how to accomplish this (bringing an xml string into a document without escaping mark-up characters) in time-efficient way.

    So you want to treat the contents of the string as XML rather than as text? Then you have to parse it.
    Or if your reason for asking is just that you don't like the look of escaped text, then use a CDATA section to contain the text.

  • How to print blank line on BIP template when the field has no value?

    I have a BIP template like below and all these CHILDREN, NAME, GRAND_CHILDREN, NAME are fields arranaged in the template as a row.Reps can enter values in each of these fields for a max upto 3 rows. The first 2 rows have the values and the last is blank.
    CHILDREN: NAME: GRAND_CHILDREN: NAME:
    Son     John Daughter     Smith
    Daughter Laura Son      Kevin
    In the third row since the fields have no values, the report print blank rows, but I want to delete that blank row and show only the rows(first 2 rows) that have values for the fields.
    Does any one know how to get around this? Please help me to resolve this.
    Thanks in advance,
    RV

    Thanks.Here is the sample XML. Fields that refer to are as follows:
    Children: DependentDD1, DependentDD2, DependentDD3
    Name: DependentFF1, DependentFF2, DependentFF3
    Grandchildren: GrandchildDD1, GrandchildDD2, GrandchildDD3
    Name: GrandchildFF1, GrandchildFF2, GrandchildFF3
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ListofIO>
    - <ListOfBipCustomerProfileReport>
    - <Contact>
    <FirstName>ROSCOE</FirstName>
    <LastName>CLOUGH</LastName>
    <LeadContactType />
    <PartyTypeCode>Person</PartyTypeCode>
    <PartyUId>XXXXXXXXX</PartyUId>
    <PersonUId>XXXXXXXXX</PersonUId>
    <PrivacyCode>Opt-Out: All Parties</PrivacyCode>
    <RelationtoHousehold />
    <SocialSecurityNumber>XXXXXXXXX</SocialSecurityNumber>
    <UserType>Prospect</UserType>
    - <ListOfA-FmrCustomerProfile>
    - <A-FmrCustomerProfile>
    <DependentDD1>Son</DependentDD1>
    <DependentDD2>Daughter</DependentDD2>
    <DependentDD3 />
    <DependentFF1>John</DependentFF1>
    <DependentFF2>Laura</DependentFF2>
    <DependentFF3 />
    <GrandchildDD1>Daughter</GrandchildDD1>
    <GrandchildDD2>Son</GrandchildDD2>
    <GrandchildDD3 />
    <GrandchildFF1>Smith</GrandchildFF1>
    <GrandchildFF2>Kevin</GrandchildFF2>
    <GrandchildFF3 />
    </A-FmrCustomerProfile>
    </ListOfA-FmrCustomerProfile>
    </Contact>
    <Login>A482003</Login>
    </ListOfBipCustomerProfileReport>
    </ListofIO>

  • How to make a form using a wizard when the table has no primary key ?

    Hi,
    I want to make a form to update, delete a table. The table has no primary key. The problem is that the Wizard ask for a primary key.
    How to avoid using a primary key ? i mean I don't want to create a primary key if is is possible.
    I would like to use the wizard; is it possible ?
    Thank you for your kind answers.
    Christian

    I believe the key is choosing 'Interactive' as opposed to 'Classic' in the implementation and then you can choose 'Existing Trigger' for the primary key source and it should work to use an existing column as your proimary key.

  • How can I migrate Vista Mail to Thunderbird when Vista Mail has no export function?

    I understand TB can directly import .eml messages and folders when they are exported correctly, but Windows Mail in Vista has no export facility. And the third-party TB add-on ImportExport Tools doesn't even list Windows Mail in its import window.
    The first line of TB's "Switching from Windows Mail or Windows Live Mail to Thunderbird" instruction page is a showstopper because it says: "In order to export messages from Windows Mail or Windows Live Mail to Thunderbird, you must export messages from the Windows application and import them into Thunderbird." How does one force Vista Mail to export mail so TB can import it?

    I have never seen the vista mail. But I have seen dialogs like this in my copy of windows live mail http://www.vistax64.com/tutorials/90298-windows-mail-messages.html Don't you have them in Vista?

  • When looking at recent calls on my iPhone running iOS 7, how can I tell which number called me when a contact has multiple numbers listed?

    I have an iPhone 5s and I am coming from an Android phone. On the Android phone, when looking at recent calls both the contact name and the number is displayed. On my iPhone I only see the contact name, in the case of contacts with multiple numbers attached how do I see which number the call came from?

    Click the "i" in the circle to the right of the contact name.
    The phone number the call came from is listed in blue.

  • How do I erase Time Machine hard disk when its power has failed?

    My 3 year old Time Machine's power recently completely failed.  Resetting didn't work.   I want to get rid of it through recycling, but am concerned about the hard disk back up contents. Is there a way to ensure the disk contents have crashed along with the power?  If not, how do I erase the hard disk?  Airport Utility no longer recognizes the machine.

    You need to remove the TC hard disk from the box.. connect via a usb adapter to your computer and format it.
    http://www.ifixit.com/Device/Apple_Time_Capsule
    It is not that hard.
    You can also repair or replace the power supply.
    https://sites.google.com/site/lapastenague/a-deconstruction-of-routers-and-modem s/apple-time-capsule-repair
    You should get your money back when you sell it.

  • How do you pay with a credit card when the Store has a cash balance?

    I think the iTunes Store automatically applies your cash balance with before it tries to charge your credit card on file. Is there a way to override this and manually enter your credit card information to pay for a song purchase?
    I have a half dozen credit cards I don't want closed. Putting a small charge on them once in a while makes sure the card accounts stay home, and purchasing a song from iTunes is one of the perfect ways of doing this. So once a month of so, I'd like to purchase a half dozen songs each with a different credit card. My store account already has $140 in cash balance, because I keep on getting iTunes gift cards faster than I can use them.
    Aside from creating a second iTunes account, whose library would be a pain to maintain the integration with my main account, is there a way to accomplish my goal?

    Gift the songs to yourself.
    (110398)

  • How do i retrieve photos from my iPhoto when the program has become unreadable?

    Its a 9.3.2 verson of iPhoto and has suddenly become unreadable.
    I am unable to open the program, so i cannot retrieve all my photos off it!
    please help!!!!

    what happens? What version of the OS?
    Back up your iPhoto library, Depress and hold the option (alt) and command keys and launch iPhoto - rebuild your database
    LN

  • How can i find my iphone serial number when my cell is off and i donot have box warranty card or itunes.

    i have only my mobile with me which is off.

    If you have a GSM model: http://support.apple.com/kb/ht4061 it should be on the sim tray.  If a CDMA model, you need to turn it on or access your iTunes, or the packaging or receipt.

  • How to write multiline String in a JLabel

    How can i write a string that is shown in many lines in a JLabel. Or is there any orher way to write them?
    Also, similarly how to write tooltip text that spans across many lines. Not just one line

    import java.awt.*;
    import javax.swing.*;
    public class UseThisTheNextTimeYouFeelLikePostingEelops {
        public static void main(String[] args) {
            String str = "This is \nmy example \nof a multi-line \nJLabel";
            JLabel strLabel = new JLabel (str);
            display(strLabel, "Hmmm...");
        public static void display(JComponent comp, String title) {
            JFrame f = new JFrame(title);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(comp);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

Maybe you are looking for