+ Reply to Thread
Results 1 to 7 of 7

If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    28

    Exclamation If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    Hello!

    I am working on an overtime sheet for my office and was wondering if someone could help. Please review the attached sheet below. Hopefully it's not too confusing!

    I would like to make it so that if someone types/selects (not sure which is easier) 'OT' in a cell under the time frames, it will change the corresponding 'OT Hours' cell to reflect a 1. Also, if 'OT2' (something similar) is typed a .5 will be added to the 'OT Hours' cell total. Subsequent 'OT's or 'OT2's in other times for that same day will also total as well. If someone types N, it will not change.

    I would also prefer if whenever 'OT' is typed it will change to a red color, while 'N' stays black.

    I am hoping this or something similar can be done, thank for reading and helping me!

    Overtime Schedule.xlsx

    -Adam

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    do you mean in c4
    =COUNTIF(D3:Q3,"ot")+COUNTIF(D3:Q3,"ot2")*1.5
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    10-28-2011
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    Thanks for the reply martindwilson,

    That formula does work. I changed the *1.5 to .5 and it fits exactly as I needed it to. Thank you sir!

    One more question though, is there a way to make some sort of macro so 'OT' and 'OT2' always appear red and 'N' black? Some people do not have normal hours at 7, so OT to them could be later than my sheet shows.

  4. #4
    Registered User
    Join Date
    01-09-2012
    Location
    N Yorkshire
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    If you have Excel 2007 or later then you can specify the cell formatting using 'Conditional Formatting .. Highlight Cell Rules' ... So if the cell contains the text "OT" then make format the font as RED, and so on.

    Regards
    Alan

    Edit - Sorry Adam, I've just noticed you have Excel version 2003 - apologies. Alan
    Last edited by Alan Kettlewell; 01-09-2012 at 04:24 AM.

  5. #5
    Registered User
    Join Date
    10-28-2011
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    Thanks for trying Alan Kettlewell,

    Unfortunately state agencies take awhile to upgrade their programs so I'm going to be stuck with 2003 for awhile.

    Is there a solution to my problem for this version of excel?

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    Hi

    ...One more question though, is there a way to make some sort of macro so 'OT' and 'OT2' always appear red and 'N' black? Some people do not have normal hours at 7, so OT to them could be later than my sheet shows.
    If i understoond well your point, you can do this in Excel2003.

    Hope to helps you
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  7. #7
    Registered User
    Join Date
    10-28-2011
    Location
    New York, USA
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: If type X then CellA = 1, if type X2 then CellA = .5 w/ SUM

    Thanks for the reply Fotis1991,

    That looks okay. Ideally, I was looking to change the actual text color, not a highlight color - but this works. Thank you.

    However, I cannot figure out how to apply this format to my document. Can you please advise me on how to use this?

+ 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