+ Reply to Thread
Results 1 to 13 of 13

Conditional Format & Vlookup Error!

  1. #1
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Red face Conditional Format & Vlookup Error!

    Hi,

    I am trying to create a Holiday Planner for my company. After extensive research and learning i have gotten so close to finishing but I am getting an error which means the dates i input are not formatting the requested cells...please see attached.

    Info:
    JAN JUN Cell I10 was the first formula with conditional formatting...I dragged this across but i get error messages and it wont colour the cells red as i am trying to request.

    Dates are taken from Sheet EmployeeData Cells BS4 to BU603. The names are repeated 10 times down this list as people may take more than 1 slot of time in the year...I hope you can make sense of it. I basically did this as I thought it was the only way VLOOKUP would work and now I'm thinking because ive repeated names this is where it is hanging up?

    I know i could have used VB but I am still trying to get my head around the basics, so I tried!

    Idon't know if this will be a problem but i did creat a macro for a calendar which i short-cut as CTRL-Z (I now have learnt this is undo)

    Thank you in advance to any help or ideas you can give!

    Regards

    Warren
    Attached Files Attached Files
    Last edited by fugro; 02-21-2011 at 11:56 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Conditional Format & Vlookup Error!

    Ive just realised what the problem is while playing with the spreadsheet, that when i drag the formula across, it changes the values within...this is gonna be painful!

    Any advice?

  3. #3
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Conditional Format & Vlookup Error!

    =IF(AND(I5>=VLOOKUP(D10,EmployeeData!BS4:BU603,2,FALSE),'JAN JUN'!I5<=VLOOKUP('JAN JUN'!D10,EmployeeData!BS4:BU603,3,FALSE)),TRUE,FALE)

    Sorry I also made a mistake in the formula, should be as above. This now formats the cell red with conditional formatting...BUT, soon as i drag across to other cells i have the problem where the cell refs change!

    Ok thanks to anyone viewing this.

  4. #4
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Conditional Format & Vlookup Error!

    Ok i'm really sorry to add to this but, how can i set my workbook so that Friday and Saturday do not count towards days off (as these are weekends here in the Middle East, well at least where i am!)

    Any suggestions just to get me on the right track are appreciated.

    This is good fun learning, but I think my life will be alot easier once i get my teeth into VB - my next goal!

    Hmm this thread is starting to make me look insane by replying to myself!

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Conditional Format & Vlookup Error!

    Hello,

    do you know the difference between absolute and relative cell references?

    =A1 copied down will become A2. Copied across will become B1
    =$A1 copied down will become $A2. Copied across will stay $A1
    =A$1 copied down will stay A$1. Copied across will become B$1
    =$A$1 will stay $A$1, wherever it is copied.

    This should help you with the changing cell references.

    cheers

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,937

    Re: Conditional Format & Vlookup Error!

    If you want to anchor the lookup array, use the '$' to make the addresses absolute:
    I don't know what the D10 cell represents or if/how it should change when dragging the formula across the row.

    Please Login or Register  to view this content.
    Ben Van Johnson

  7. #7
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Conditional Format & Vlookup Error!

    Thanks for your advice, I believe this will solve it.

    Any idea on the Fri/Sat thing? If not I suppose I could just delete those days?

    Regards

    Warren

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,937

    Re: Conditional Format & Vlookup Error!

    This solution requires an additional sheet (cal) and the formula:
    Please Login or Register  to view this content.
    The Cal sheet assumes that Sunday is day one of the week and so, does not count days six and seven(Friday,Saturday)

    The first ADDRESS fn finds the top of the search range, the second, the bottom
    Attached Files Attached Files
    Last edited by protonLeah; 02-21-2011 at 11:51 PM.

  9. #9
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Conditional Format & Vlookup Error!

    Ben,

    Ok ive tried that but i seem to be just getting values of 0. Ive renamed that sheet Cal and inputted formula then put dates in K7 & L7 on EmplyeeData...zero answer...

    I also seem to be getting a runtime error when running my Calendar userform stating:

    Run-time error '1004':
    Unable to set the NumberFormat property of the Range Class.


    I click debug then get my form with part highlighted:

    Private Sub Calendar1_Click()

    ActiveCell = Calendar1.Value

    ActiveCell.NumberFormat = "dd/mm/yy"
    End Sub

    Private Sub UserForm_Activate()

    Me.Calendar1.Value = Date

    End Sub
    Please advise if you have time.

    Best Regards

    Warren

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,937

    Re: Conditional Format & Vlookup Error!

    Please post your latest workbook.

  11. #11
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Conditional Format & Vlookup Error!

    Fugro,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  12. #12
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Conditional Format & Vlookup Error!

    Hi everyone,

    I managed to find out the reason my form was not working was due to the fact that i had protected the sheet. I would post my latest work but it is up to 4MB...this is why i need to learn VB!

    I just want to thank everyone for their help, really is much appreciated that you give your time so freely to helping others!

    Next time I will code/uncode the text, thanks teyln

    I now need to close this as Solved!?

    Best Regards

    Warren
    Last edited by fugro; 02-21-2011 at 11:52 PM. Reason: acknowledge request by Forum Moderator re: [code]

  13. #13
    Registered User
    Join Date
    01-24-2011
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    16

    [SOLVED]Conditional Format & Vlookup Error![/SOLVED]

    Thanks for everything.

+ 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