+ Reply to Thread
Results 1 to 6 of 6

IF Command based on cell or IF/AND command -HELP needed

  1. #1
    Registered User
    Join Date
    07-23-2012
    Location
    Bedford, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    IF Command based on cell or IF/AND command -HELP needed

    IF command based on cell content.
    In sheet 1 I have columns with a shift name with hours over 3 weeks with start and end times.
    In sheet 2 I have employee names and the shift name.
    I need help with IF/AND statement where if Shift Name in sheet one is copied to Sheet 2 then copy the start and end times from sheet 1 to sheet 2 over a cell range.

    Sample sheet attached.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: IF Command based on cell or IF/AND command -HELP needed

    is this a 3-week cycle, or how do we know where to put the answer?

    and btw, its always better to avoid "merge and center" and use "center across selection" instead. it makes calcs and references much easier
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: IF Command based on cell or IF/AND command -HELP needed

    see if the attached gives you what you need?

    I added data validation to your "shift name" on sheet2 to make sure the correct names are used

    another suggestion would be to transpose your table so that the days go down instead of across. that way you can get a whole year into 1 sheet. i always find it better to construct a work sheet such that the data that will grow (ie as more records/data is added) goes from top to bottom, while fixed headings that will rarely increase/decrease go across the top
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-23-2012
    Location
    Bedford, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: IF Command based on cell or IF/AND command -HELP needed

    Thank you so much...this is just what I needed.
    However a quick question...I know your formula is spread over 3 weeks but i wanted it to auto populate all the columns..to the end
    This is your formula: =IF(VLOOKUP($B7,Shifts!$A$5:$AQ$52,COLUMN()-1,FALSE)=0,"",VLOOKUP($B7,Shifts!$A$5:$AQ$52,COLUMN()-1,FALSE))

    Would I change AQ to IV ?
    Last edited by Cutter; 07-27-2012 at 09:56 AM. Reason: Removed whole post quote

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: IF Command based on cell or IF/AND command -HELP needed

    yes, my formula was based on you only having 3 weeks on your original sheet, so if you add more weeks, change the $AQ$ to AQ$, it should adjust itself across as you copy.

    however, (and i know you have already put a lot of work into this), i would still suggest that you consider swinging your table around - you have far more rows than you have columns

    If this answered your question, please take a moment to mark the tread as "solved" - it helps keep things neet and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below

  6. #6
    Registered User
    Join Date
    07-23-2012
    Location
    Bedford, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: IF Command based on cell or IF/AND command -HELP needed

    I have swinged the tables around as you suggested....on Sheet 1. Is that what you were suggesting?
    The formula that you gave would now change?
    I had 3 weeks on the Shifts sheet as some shifts are 3 week rotating shifts that span over the whole year and therefore need to be copied over the 52 week period.

    I have attached the modified spreadsheet.

    Thank you so much for your help. Much appreciated

+ 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