+ Reply to Thread
Results 1 to 20 of 20

VBA code that will get the desired data using datas on a column with diff. sheets

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Question VBA code that will get the desired data using datas on a column with diff. sheets

    I tried watching tutorials and tried to do it.. i stumble upon vlookup but the tutorial i watched used the name manager with the offset formula.. i tried to mimic it but i got an error..
    my project is kinda complicated.. well.. i think it is.. because im a beginner..

    need help.. here is a an example of what im working.. this is only requirement number 1..

    this is the link of the workbook...

    and the rules are in here too..

    https://app.box.com/s/cjjkgrctfor781ae5rmk

    Thanks, i hope someone can help me
    Last edited by richzter; 05-15-2014 at 06:41 AM. Reason: forum rules

  2. #2
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    VBA code that will get the desired data using datas on a column with diff. sheets

    I tried watching tutorials and tried to do it.. i stumble upon vlookup but the tutorial i watched used the name manager with the offset formula.. i tried to mimic it but i got an error..
    my project is kinda complicated.. well.. i think it is.. because im a beginner..

    need help.. here is a an example of what im working.. this is only requirement number 1..

    this is the link of the workbook...

    and the rules are in here too..

    https://app.box.com/s/cjjkgrctfor781ae5rmk

    Thanks, i hope someone can help me

  3. #3
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    .....bump.....

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    unsure how this is VBA related....

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by humdingaling; 05-16-2014 at 03:40 AM.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Quote Originally Posted by humdingaling View Post
    unsure how this is VBA related....

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

    thanks for helping.. can you please explain how it works? thanks

    Ps.
    if it uses the exact range only i think i cant use it.. i am asked to create a program that will get the value even if the table is messed up.. for example.. the user suddenly adds a column/row.. will it still work?
    Last edited by richzter; 05-18-2014 at 09:01 PM.

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Please Login or Register  to view this content.
    unrestricted range of the code

    basis of the formula is
    checked for Student number in table on "students Records" sheet
    if it is not blank it directs does a vlookup on student number against table in "updates" Sheets

    if it is blank, it takes the student Name and does vlookup against student record
    surrounding this vlookup however is an error check
    the assumption is if the student number is blank and the student name returns error on the vlookup it then makes the field blank . ie ""
    Last edited by humdingaling; 05-18-2014 at 09:11 PM. Reason: updated sheet reference

  7. #7
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Quote Originally Posted by humdingaling View Post
    Please Login or Register  to view this content.
    unrestricted range of the code

    basis of the formula is
    checked for Student number in table on "students Records" sheet
    if it is not blank it directs does a vlookup on student number against table in "updates" Sheets

    if it is blank, it takes the student Name and does vlookup against student record
    surrounding this vlookup however is an error check
    the assumption is if the student number is blank and the student name returns error on the vlookup it then makes the field blank . ie ""
    thanks..

    but what if the second search is like this.. you need to use the student no. as a key but in the other sheet is named cleared student no.?
    and the one you will get is Course Choice..

    is there some way we can declare that?
    Last edited by richzter; 05-18-2014 at 11:02 PM.

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    don't quite understand what you are asking

    you saying if table in updates does not have student number?

    if this is what you can use IFERROR similar to the student name vlookup

  9. #9
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Quote Originally Posted by humdingaling View Post
    don't quite understand what you are asking

    you saying if table in updates does not have student number?

    if this is what you can use IFERROR similar to the student name vlookup
    ... no i mean.. it does have student no. but different in column name/header

    example.. im looking for id number.. but the other sheet doesnt have 1, it has Student number instead.. it has the same data's only it has a different header name.
    Last edited by richzter; 05-19-2014 at 01:05 AM.

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    sorry not sure what you are asking
    can you provide sample data?

  11. #11
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Quote Originally Posted by humdingaling View Post
    sorry not sure what you are asking
    can you provide sample data?
    i only tweeked some info..
    https://app.box.com/s/cjjkgrctfor781ae5rmk

  12. #12
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    so you have added some which arent meant to show up?
    isn't Rule 4.if no course is found using above rules course=blank

    ie Buddy, Amy and Rinoa are blank
    isnt that what is meant to happen?

    Please Login or Register  to view this content.
    also i have changed the code abit to not the table "name"

  13. #13
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    yeah some of it is meant to be blank.. actually i only changed the column header

  14. #14
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Quote Originally Posted by richzter View Post
    yeah some of it is meant to be blank.. actually i only changed the column header
    it made no difference in the vlookup?
    because you are not looking up the header you are looking up the data set under the header

  15. #15
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    oh yeah.. i just tried.. but when i add some row and columns the value turns to 0..

  16. #16
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Ps.
    if it uses the exact range only i think i cant use it.. i am asked to create a program that will get the value even if the table is messed up.. for example.. the user suddenly adds a column/row.. will it still work?
    sorry its true the column name doesnt matter haha silly me :P

  17. #17
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    i just read the original question and forgot you are only just learning vlookup

    maybe this will help you conceptualise it
    http://www.howtogeek.com/howto/13780...okup-in-excel/

    if combines vlookup and if/isblank combination
    only thing to remember is the table array is the important part of the vlookup and reference is really important

    if you dont understand the $ signs and its application this is a really good link that explains it
    http://www.cpearson.com/excel/relative.aspx

  18. #18
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    i cant use vlookup. because when the user adds multiple row/columns the value changes..

  19. #19
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    rows should not effect the result if you just put the whole column reference instead of a table reference
    A1:C17 > should be A:C

    Columns....you need to control this
    unless you want to relative column index number

    however this will require the headers and the placing of the headers will play have more relevance
    ie
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This formula will look for C8 which is "COURSE"
    in update sheet...however in the update sheet you have it as "Course enrolled"
    if you change header to course it will return value 2, of which you can combine into your vlookup to give
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    add Replicate into the main formula given in previous posts
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    the same needs to be done with your Student records ...but the header row on that sheet is row 3

    Now if you insert columns in the update sheet
    the TABLE array would update...but the column index number would change to "match" the header which in this case is "COURSE"

    as you can see there is a lot you need to control and amend in order to make it work
    and you do need to understand every bit of it in order to amend or make changes
    Last edited by humdingaling; 05-19-2014 at 09:05 PM.

  20. #20
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: VBA code that will get the desired data using datas on a column with diff. sheets

    Can you post the exact rules to make it clearer?

+ 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: 05-02-2014, 03:05 PM
  2. [SOLVED] Function that concatenates multiple sub-project descriptions based on project code
    By markbpi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-28-2012, 06:49 PM
  3. [SOLVED] Insert Blank Rows between sorted projects, Subtotal project to the right of final project.
    By ZAC7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2012, 04:08 AM
  4. VBA Project and Modules Remain in Project Explorer after workbook closed
    By avr5iron in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 03-09-2012, 11:38 AM
  5. Replies: 1
    Last Post: 10-18-2005, 11:05 AM

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