Consulting

Results 1 to 13 of 13

Thread: VLOOKUP question

  1. #1
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location

    VLOOKUP question

    I'm using a named range in my VLOOKUP and if I hide some of the columns if doesn't work. Can you not hide columns in a VLOOKUP?
    Peace of mind is found in some of the strangest places.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I just tried it and it worked fine here. Which columns are hidden?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    O and P
    Peace of mind is found in some of the strangest places.

  4. #4
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Might be user error. That would be me.
    Peace of mind is found in some of the strangest places.

  5. #5
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Thanks Bob. Here is a related VLOOKUP question.

    Have three cells named Age, SPAge and Split.

    If Split = "Yes" and Age < 65 and SpAge > 65 then I need to use another named range called "Years of Service" to do a VLOOKUP on a named range called "Indemnity", then I need to take column 7 and 16, add them and divide by 12.

    Can you do that in a formula?
    Peace of mind is found in some of the strangest places.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try

    =(VLOOKUP(YearsOfService,Indemnity,7,FALSE)+VLOOKUP(YearsOfService,Indemnit y,16,FALSE))/12
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Never thought about nested VLOOKUP's. Ill give it a go.
    Peace of mind is found in some of the strangest places.

  8. #8
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Spot on. Thanks.
    Peace of mind is found in some of the strangest places.

  9. #9
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Hmmm...When I put this in a Sub and run it I get wacky answers:

    [VBA]=vlookup(YearsofService, Indemnity, 7, False) + Vlookup(YearsofService, Indemnity, 16, FALSE)/12[/VBA]

    7 = 3563.33
    16 = 2691.43

    Am I missing a () somewhere?
    Peace of mind is found in some of the strangest places.

  10. #10
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location


    Never mind I see it.
    Peace of mind is found in some of the strangest places.

  11. #11
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    One more question. Trying to test both ways in this. Works fuine with the first If, but the second one gives "#VALUE" error.

    [VBA]=IF(AND(Age>65,SPAge<65),"Yes","No"),IF(AND(Age<65,SPAge>65),"Yes","No")[/VBA]
    Peace of mind is found in some of the strangest places.

  12. #12
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this

    =IF(OR(AND(Age>65,SpAge<65),AND(Age<65,SpAge>65)),"Yes","No")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  13. #13
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    You know it works. Thanks Bob.
    Peace of mind is found in some of the strangest places.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •