+ Reply to Thread
Results 1 to 4 of 4

searching a range within a range

  1. #1
    Registered User
    Join Date
    02-01-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    9

    searching a range within a range

    Hi. Me = macro neophite, mostly just record macros and tweak as need be. But need help with this one.

    Trying to enter pay rates into a data sheet when an employee works in a specified department.

    My logic may be off, but what I want to do is this:

    for each cell in A:A
    the cell = employee#
    if (the cell in column D is not null AND the cell in column e is blank) then the cell in column D is the department

    go to sheet to and for each cell in range A:A of sheet 2
    if the active cell = employee and the corresponding cell in column c = dept, then copy the corresponding cell in column D of Sheet 2 and paste it into column E of the first sheet.

    I attached a sample of the data. The actual sheets are hundreds of pages long and will take me a couple days to go through without a macro - so if anyone is in a generous mood, I'd appreciate the help.

    Thanks.

    I know it is really wrong and its embarraising for me to post it, but this where I got so far and decided that I needed help

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mr.alexander; 11-29-2010 at 12:29 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: searching a range within a range

    Hi

    How about building your own function.

    Using your example file, open a general module and enter the code
    Please Login or Register  to view this content.
    Then in sheet1!E2 enter:
    Please Login or Register  to view this content.
    Copy down as required.

    HTH

    rylo

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: searching a range within a range

    I am not exactly sure what you are doing
    This would work in E2 and dragged down
    =SUMPRODUCT(--(Sheet2!$A$2:$A$46=A2),--(Sheet2!$C$2:$C$46=D2), --(Sheet2!$D$2:$D$46))
    I do not see what determines true or false

  4. #4
    Registered User
    Join Date
    02-01-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: searching a range within a range

    I tried the function but have no experience with them and couldn't get it to work. Then I tried davesexcel formula and it gave me errors, but it was a good start and helped me think better, especially trying to answer the true or false question, it helped me to realize that it wasn't relevant. I settled on using this formula instead of a macro or function;

    Please Login or Register  to view this content.

+ 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