Consulting

Results 1 to 8 of 8

Thread: Lookup column value and find value

  1. #1

    Lookup column value and find value

    .

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    What?

    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Quote Originally Posted by SamT View Post
    What?

    lol!
    Chris Macro

    The Spreadsheet Guru
    Using Office 2007 (Windows 7) & Office 2013 (Windows 8)
    Twitter | Facebook| Google+

  4. #4
    VBAX Contributor D_Marcel's Avatar
    Joined
    Feb 2012
    Location
    Tokyo
    Posts
    117
    Location
    Quote Originally Posted by SamT View Post
    What?


    KKK
    "The only good is knowledge and the only evil is ignorance". Socrates

  5. #5
    Hello,

    Sorry I have not posted what I wanted but I thought I found an answer but unfortunately I failed.
    If not found in the crystal response to my request :lol then please help me in the following problem:
    In Sheet2 I have a database of sales per month in January 2014.
    I would like that depending on the name chosen in B2 to display top 10 sales in E2: E11 and in D2: D11 day for these sales.

    I attached a file and to see how is the data.
    Thank you.
    Attached Files Attached Files

  6. #6
    VBAX Contributor D_Marcel's Avatar
    Joined
    Feb 2012
    Location
    Tokyo
    Posts
    117
    Location
    Some suggestions:

    > Using the .Find method, get the corresponding address of the cell "B2" in the Sheet2.
    > Using a For To structure (loop), read all the values and respective dates, inserting them into a bi-dimensional array. I'm not sure if you can insert into the same array, dates and numbers.

    [VBA]Set WorkArea = Sheet2.Range(Cells(2, 1), Cells(Cells(Rows.Count, 1).End(xlUp).Row, 1))
    Set Target = WorkArea.Find(Sheet1.Cells(2, 2).Value)


    For Y = 2 To 31
    ReDim Preserve MyArray(Y)
    MyArray(Y) = Sheet2.Cells(Target.Row, Y).Value
    Next Y[/VBA]

    > Load the values of your bi-dimensional array in the corresponding cells of 'Date' and 'Sales' using another loop with the commands UBound and LBound.

    Good luck.

    Douglas
    "The only good is knowledge and the only evil is ignorance". Socrates

  7. #7
    Hi Douglas,

    Thanks for the reply. Sorry, do not know to program in VBA. If you can help me with complete code would be great, otherwise I will try to solve the problem using formulas.
    If someone can help me with formulas would be great. Thanks.

  8. #8
    VBAX Contributor D_Marcel's Avatar
    Joined
    Feb 2012
    Location
    Tokyo
    Posts
    117
    Location
    Guess this can't be done with formulae, I don't know a way to get the second, third, fourth... max values of a range. Perhaps we can use HLOOKUP to get the date acording to the value, but if you have a number that repeats, will be a problem because the formula will return the same date.

    I'll try to think in something, but keep researching and try you also.
    "The only good is knowledge and the only evil is ignorance". Socrates

Posting Permissions

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