+ Reply to Thread
Results 1 to 8 of 8

Dates and if statement

  1. #1
    Registered User
    Join Date
    02-12-2008
    Posts
    22

    Dates and if statement

    First, a brief background on me. I am in the Army and am the personal administrative assistant to the battalion Commander, Command Sergeant Major, and Executive Officer. Currently, I am re-designing out battalion personnel roster so all our companies are using the same format. I'm no stranger to code, but cannot figure out some of the more complex stuff I want to be able to calculate.

    Ok, here's my conundrum: I am working with two sheets. The first sheet has the list of every soldier, their MOS (job), and the DEROS (date they are scheduled to leave the unit). I have added what is called a "LOSS" column on this sheet that tabulates exactly how many days each soldier has left and shades the cell according to what zone they are in (Green for 90-60 days, Yellow for 60-30 days, Red for less than 30 days).

    The second sheet has a list of every MOS and three columns beside each - one for 90 Day Loss, one for 60 Day Loss, and one for 30 Day Loss.

    What I need to do is be able to total how many of each type of LOSS (30, 60, 90) each MOS has from the first sheet onto the second sheet.

    Does that make sense? I surely hope so, because I've been wracking my brain trying to figure out how to write it. If it requires further explanation to perhaps an example with filled in info, I can try. Thanks in advance, and I hope someone can help me.

    -Gunslinger
    Last edited by FSCGunslinger; 02-12-2008 at 06:12 AM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Without seeing your data sheet, may be something along these lines, using SUMPRODUCT?

    By the way - please read the rules on posting

    http://www.excelforum.com/showthread.php?t=613916
    Attached Files Attached Files
    Last edited by oldchippy; 02-12-2008 at 06:48 AM.
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    02-12-2008
    Posts
    22
    Quote Originally Posted by oldchippy
    Hi,

    Without seeing your data sheet, may be something along these lines, using SUMPRODUCT?

    By the way - please read the rules on posting

    http://www.excelforum.com/showthread.php?t=613916
    oldchippy,

    My apologies for failing to title my thread properly. I will be sure to do so in the future.

    Your code is almost what I need. The problem comes in the sense that I am using a cell that tabulates the exact number of days that each soldier has left, not just a flat titling of "30", "60", or "90".

    The code I'm using to calculate the days left until a soldier's DEROS is
    Please Login or Register  to view this content.
    Where the "K" column is the DEROS column and the "#" is the row. Obviously, some of the numbers in this column will be greater than 90, but the only ones I care about and have highlighted with conditional formating are 90 through 0.

    P.S. I appear to have a problem with my "number of days left (LOSS)" tabulation. When entering today's date a year from now in the DEROS column, I get 360 in the LOSS column. However, when I chance the DAYS360 to DAYS365 in my coding, I get an error.

    I have attached an altered excel file.
    Attached Files Attached Files
    Last edited by FSCGunslinger; 02-12-2008 at 07:49 AM.

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    I've adjust the formulas in the table, does this help? If not it may be better to post a sample zipped sample of your spreadsheet.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-12-2008
    Posts
    22
    Quote Originally Posted by oldchippy
    Hi,

    I've adjust the formulas in the table, does this help? If not it may be better to post a sample zipped sample of your spreadsheet.
    Looks like we were posting about the same time. I'm gonna plug in your code and see if it works. Thanks.

  6. #6
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Try This

    He gunslinger try this

    Based on the number of days left i assigned it a category (<90,<60,<30)

    now that way its much easier to count

    Hope this helps.
    Attached Files Attached Files
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  7. #7
    Registered User
    Join Date
    02-12-2008
    Posts
    22
    oldchippy,

    It worked marvelously! I've attached what the pseudo-final product is meant to look like. Thank you so much! Macdave, thanks for the suggestion!
    Attached Files Attached Files

  8. #8
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Looks good to me - thanks for the feedback

+ 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