+ Reply to Thread
Results 1 to 13 of 13

IF,OR,Vlookup to pull multiple sheet data

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    IF,OR,Vlookup to pull multiple sheet data

    I have mentioned formula in K3:KO but I could not able to get the desired result as stated in B:G.

    Pls help me what is wrong in the syntax.Also pulling list as unique from different sheet.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: IF,OR,Vlookup to pull multiple sheet data

    The IFERROR logic you are trying to use will not work, it will not generate an error just because the result cell is empty. Also, when putting minus in front of VLOOKUP you have to wrap it with parenthesis, I got many crashes because of this.

    This seems to work but I didn't implement the check for empty input cell. I did implement INDIRECT so you can just drag the formula to the right and it will work.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Not sure about all those zeroes in the Sheet3 results.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: IF,OR,Vlookup to pull multiple sheet data

    Thanx a lot.

    Lastly, how to combine list A column data of each worksheet by formula without any duplicates which manually I have done in J column.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,141

    Re: IF,OR,Vlookup to pull multiple sheet data

    This is easier on the eye!! But it's still Jacc's formula.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: IF,OR,Vlookup to pull multiple sheet data

    Hi paradise2sr,

    I took a slightly different approach to Jacc because I assumed that you would not have Sheet1, Sheet2 as headings.

    My formula was =IFERROR(VLOOKUP($B3,Sheet1!$A$2:$C$20,2,0)-VLOOKUP($B3,Sheet1!$A$2:$C$20,3,0),"") - and editing the Sheet1 component.

    If you want to follow Jacc's suggestion, I recommend =IFERROR(VLOOKUP($J3,INDIRECT(K$2&"!$A$3:$C$8"),2,0)-VLOOKUP($J3,INDIRECT(K$2&"!$A$3:$C$8"),3,0),"") which is a little shorter, and gives blanks instead of zeros.

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  6. #6
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: IF,OR,Vlookup to pull multiple sheet data

    Yeah I got but kindly refer to my post #3.

    Here I am expecting to get formula for listing A column data without any duplicates into one sheet which I have mentioned in summary sheet in J column. Rest above formula are fine and thanx for all of u.

  7. #7
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: IF,OR,Vlookup to pull multiple sheet data

    Didn't see your post #3 until now.

    I think the answer has to be using VBA.

    Here are a couple of macros which will loop through your worksheets, create a list from Column A on each sheet to Column A on the SUMMARY sheet.

    The second macro then sorts the list in alpha order, and removes the duplicates.

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".




    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: IF,OR,Vlookup to pull multiple sheet data

    That solved the problem, well done!
    Nevertheless, there are a few details in the code that triggered me to go all Yoda here.

    Option Explicit is strongly recommended as it forces you to declare variables.
    Makes troubleshooting soooooooo much easier. It also makes the code run faster but in this case it probably wouldn't be noticeable.

    Another minor improvement is the addition of switching calculation on and off. I think this dataset is too small for anyone to notice the timedifference but on large data sets it makes a difference.

    Copy paste is a heavy, slow process which is rarely needed. I'm doing the same thing here with just =. This will make a big difference on this workbook.
    By removing the copy paste, it is also possible to remove the Activate command in most places. Activate and Select are also very slow commands, they also make a big difference even on a small workbook.
    Finally I removed a lot of parameters for the sort method since those are correct by default. Looks neater, that's all.
    In a half donkey attempt to be correct I passed the Summary worksheet as a parameter to the sorting Sub.

    Faster the code now is.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Jacc; 09-04-2016 at 04:21 PM.

  9. #9
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: IF,OR,Vlookup to pull multiple sheet data

    Quote Originally Posted by Jacc View Post
    That solved the problem, well done!
    Nevertheless, there are a few details in the code that triggered me to go all Yoda here.
    Thanks Jacc (or Yoda if you prefer). I am sort of self taught with VBA, and can see the wisdom of what you say. Some really good points I hope I can learn from and remember.

    I think another improvement could be added. If we picked up each sheet name as we go through the ws loop, the column headings on the Summary sheet could be created, thus saving the user the need to do this. Obvious benefit of avoiding typos etc.

    How would you code this?

    DAC
    Last edited by David A Coop; 09-04-2016 at 08:48 PM.

  10. #10
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: IF,OR,Vlookup to pull multiple sheet data

    Great Thanx Jacc & David.

    Infact in real life I am dealing with a large data set more than 8000 rows.Since here it is limit and due to privacy only a sample I am able to post.And Rest copy paste you have already explained.

    And Thanx for your more improved faster code thinking for large data set without any helper column.


    This solved my issue.
    Last edited by paradise2sr; 09-04-2016 at 11:24 PM.

  11. #11
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: IF,OR,Vlookup to pull multiple sheet data

    You're welcome paradise2sr.



    DAC

  12. #12
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: IF,OR,Vlookup to pull multiple sheet data

    Sorry dup post

  13. #13
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: IF,OR,Vlookup to pull multiple sheet data

    Good to hear my code is appreciated!

    Picking up the sheets as you go along makes a lot of sense considering the large dataset. I'm guessing the sheet numbers is the way to go:
    Please Login or Register  to view this content.
    Also the formula should be added via VBA for the same reason.
    Getting the headers in place is fairly straight forward. As for the formulas the macro recorder is a good help. Simply start recording, hit F2 in a formula cell, then enter, then stop recording. The formula is now ready to be copied from the latest recording in R1C1 format. The R1C1 format looks the same throughout the range so once the range to where the formula should be applied has been established you apply the formula to the whole range at once like this:
    Please Login or Register  to view this content.
    .

    Another question to ask is whether the formula should be there at all? Afterall, the same calculations can be made in VBA. An 8000 line recalc every now and then may slow things down.
    I would probably go for the formula solution anyway because it only takes one tiny line of code to convert from formula to static values should that be needed:
    Please Login or Register  to view this content.
    Using the ' in the code it is easy to switch this line on and off to find out what works best for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 04-20-2015, 03:18 PM
  2. [SOLVED] Do vlookup and pull data from 2 or 3 sheets to another sheet
    By lavz in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-19-2013, 12:06 PM
  3. VLOOKUP to pull data from multiple columns
    By Paragoomba in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-11-2013, 08:47 AM
  4. Replies: 7
    Last Post: 10-06-2012, 06:19 AM
  5. Pull data from one sheet to another using multiple criteria
    By Farhaad Saleh in forum Excel General
    Replies: 5
    Last Post: 07-22-2011, 10:32 AM
  6. Vlookup across sheet to pull data to new workbook
    By Nandini in forum Excel General
    Replies: 1
    Last Post: 07-13-2011, 07:12 AM
  7. Excel 2007 : Pull data from multiple sheet
    By cmsileo in forum Excel General
    Replies: 5
    Last Post: 12-08-2010, 02:56 PM

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