+ Reply to Thread
Results 1 to 9 of 9

Assiging a number value

  1. #1
    Registered User
    Join Date
    09-01-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Assiging a number value

    How do I assign a number value to a letter.
    I'm making a class attendence spread sheet.
    I want to assign 10 points for "P" Present
    7 points for "T" Tardy etc.
    How do I prevent it from interfering with all the assigned P/Ts etc.

    Thanks

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Assiging a number value

    There are a number of ways to go about this.

    Here is one way.

    Say cell B2 contains the letter "P" or "T".

    Cell C2 could contain this formula:

    =if(B2="P",10,if(B2="T",7,0))

  3. #3
    Registered User
    Join Date
    09-01-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Assiging a number value

    Thank you. I entered the formula in Cell B2 but when I type the Letter "P" in the cell it overtypes the formula.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Assiging a number value

    You could use the COUNTIF function to total points as discussed.

    If you have the attendance record for a pupil in cells A1:A10,

    This formula

    =(COUNTIF(A1:A10,"P")*10)+(COUNTIF(A1:A10,"T")*7)

    Will return the total points for that pupil.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Assiging a number value

    I entered the formula in Cell B2 but when I type the Letter "P" in the cell it overtypes the formula.
    As I mentioned in the first post, you would place the formula in cell C2 and make entries of "P" or "T" in cell B2.

    A cell can contain ONLY a value directly entered or a value that is the result of a formula. As you have discovered, formulas are overwritten when data in directly entered into the cell (unless you apply protection to the cell/worksheet).

    Bottom line: use cell B2 for data entry and cell C2 as a formula cell to determine which value to assign to the letter in B2.

    See these links for Excel Training Resources.

    Free EXCEL Training
    Contextures

  6. #6
    Registered User
    Join Date
    09-01-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Assiging a number value

    Quote Originally Posted by sweep View Post
    You could use the COUNTIF function to total points as discussed.

    If you have the attendance record for a pupil in cells A1:A10,

    This formula

    =(COUNTIF(A1:A10,"P")*10)+(COUNTIF(A1:A10,"T")*7)

    Will return the total points for that pupil.
    Thanks! That worked great. How do I assign a cell, that will have no data enetered into it, a number value.
    Last edited by lmparedes; 09-01-2009 at 10:42 PM.

  7. #7
    Registered User
    Join Date
    09-01-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Assiging a number value

    Quote Originally Posted by Palmetto View Post
    As I mentioned in the first post, you would place the formula in cell C2 and make entries of "P" or "T" in cell B2.

    A cell can contain ONLY a value directly entered or a value that is the result of a formula. As you have discovered, formulas are overwritten when data in directly entered into the cell (unless you apply protection to the cell/worksheet).

    Bottom line: use cell B2 for data entry and cell C2 as a formula cell to determine which value to assign to the letter in B2.

    See these links for Excel Training Resources.

    Free EXCEL Training
    Contextures
    I see my error. I can not enter data in a cell where a formula is being used.
    Thanks! How do I assign a cell, that will have no data enetered into it, a number value.
    Last edited by lmparedes; 09-01-2009 at 10:43 PM. Reason: error

  8. #8
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Assiging a number value

    To extend my original example:

    If cells containing P are worth 10, those containing T are worth 7, and those that are blank are worth 3;

    =(COUNTIF(A1:A10,"P")*10)+(COUNTIF(A1:A10,"T")*7)+(COUNTIF(A1:A10,"")*3)

  9. #9
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Assiging a number value

    How do I assign a cell, that will have no data enetered into it, a number value.
    My original formula assigns a value of zero if the cell doesn't contain "P" or "T". If the cell is empty what value do you want to assign to it?

    You could just change the last argument from zero to another number.
    =IF(B2="P",10,IF(B2="T",7,3))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1