+ Reply to Thread
Results 1 to 5 of 5

help with writing IF formula

  1. #1
    Registered User
    Join Date
    08-03-2010
    Location
    puckeridge,herts
    MS-Off Ver
    Excel 2003
    Posts
    43

    help with writing IF formula

    Hi
    I am having some trouble writing an IF statement. I think it may be more than an IF statement that is needed, but not sure what to do. I have attached an example of what I am trying to achieve. Sheet 1 is a rota, and H indicates holiday. On sheet 2, I want to see the actual booked holiday dates booked by each staff member. On sheet 1 of the attached example, I have made a rota, and on sheet 2, I have typed in the dates, as to how I need it to look.
    Any help would be greatly appreciated.
    many thanks
    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,946

    Re: help with writing IF formula

    I swung your table around, you are likely to have faer more dates than names, and its always better to have dates go downwards....

    B
    C
    D
    E
    F
    11
    PAUL JOHN SIMON MIKE PATTY
    12
    1/17/2015
    1/5/2015
    1/7/2015
    13
    1/18/2015
    1/13/2015
    1/8/2015
    14
    1/19/2015
    1/22/2015
    1/13/2015
    15
    1/20/2015
    1/28/2015
    1/14/2015
    16
    1/16/2015
    17
    1/21/2015
    18
    1/22/2015
    19
    1/29/2015
    20
    1/30/2015


    B12=IFERROR(INDEX(Sheet1!$A$4:$A$33,SMALL(IF(Sheet1!B$4:B$33="H",ROW(Sheet1!$A$4:$A$33)-3),ROWS($A$1:$A1))),"")
    ARRAY entered, then copied down and across.
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    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
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: help with writing IF formula

    Hi mdot,

    I've also moved your data around in 2 different sheets and done Pivot Tables on them. This is just to let you see other ways to see your data. See if these are better than what you now have.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: help with writing IF formula

    I kept your existing format. But you will see it complicates the formula.

    You need a different formula for each staff member.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

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

    Re: help with writing IF formula

    not quite true one way keeping original layout
    =IFERROR(SMALL(IF(INDEX(Sheet1!$B$4:$F$34,0,MATCH($A5,Sheet1!$B$3:$F$3,0))="h",Sheet1!$A$4:$A$34,""),B$4),"") array entered
    in b5 then filled across and down
    Attached Files Attached Files
    "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

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Writing formula with IF, <, >, and =0
    By joshfulcher in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-22-2014, 04:46 PM
  2. Writing formula using vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2011, 07:54 AM
  3. Excel 2007 : Help writing a formula
    By JULIE1983 in forum Excel General
    Replies: 1
    Last Post: 03-02-2010, 01:39 PM
  4. Replies: 2
    Last Post: 01-03-2006, 05:42 PM
  5. Help writing a formula
    By paul in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-06-2005, 04:05 AM

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