Consulting

Results 1 to 7 of 7

Thread: Solved: Is there a formula solution?

  1. #1
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location

    Solved: Is there a formula solution?

    This is not my problem, but if

    I have a workbook with 4 sheets. I want to go through sheet 1 and test to see if the value of RowX ColumnY exists in sheets 2 and 3, if so then I want to write the entire row to sheet 4. This would be done all the way down column Y until NULL.
    while iterating the values in the cells in sheet1, is there some use of index/match etc.. to compare values in sheets 2,3 rather than poking the values by referencing both sheets via sheet.cells(r,c).value

    Hope this makes sense... Stan

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    I guess the answer is NO.

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    Stanl, for those of us who are mentally challenged.... can you post an example please
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Using Values in Column B and sheet1, compare to values in sheets 2/3 and copy entire row to sheet 4 if valid. The question was not whether this could be done, but could it be done with a formula rather than writing a For Each... or While loop in code.

    Stan

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Plug this into A1 on sheet4, then copy or fill it where you want

    =IF(Sheet1!$B1=Sheet2!$B1,IF(Sheet1!$B1=Sheet3!$B1,Sheet1!A1,),)

  6. #6
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Try...


    Input formula in Sheet4 cell A2 custom format cell with:

    0;-0;;@

    then fill across then copy down.

    =IF(OR(Sheet1!$B3=Sheet2!$B2,Sheet1!$B3=Sheet3!$B2),Sheet1!B3,"")


    But if you need to look in a range of cells then input formula in sheet4 cell A2 fill across and copy down.

    =CHOOSE({1,2},IF(SUMPRODUCT(--(Sheet1!$B$3:$B$30=Sheet2!$B2))=0,"",Sheet1!B3),IF(SUMPRODUCT(--(Sheet1!$B$3:$B$30=Sheet3!$B2))=0,"",Sheet1!B3))


    Hope it helps!
    Last edited by Shazam; 10-28-2006 at 09:45 PM.
    SHAZAM!

  7. #7
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Thanks all.... Again, the original problem is not mine, it was posted on a non-VBA BBS by a user looking for a programmatic solution. I thought he might consider a formula and the question raised my own curiosity

    Stan

Posting Permissions

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