+ Reply to Thread
Results 1 to 10 of 10

Need to copy data cells from one sheet to another based on unique identifier

  1. #1
    Registered User
    Join Date
    02-23-2015
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    6

    Need to copy data cells from one sheet to another based on unique identifier

    Hi there,

    I am new here and I just registered in this forum to post this thread, therefore please be kind to me. I may become a regular poster, who knows?

    I am struggling with something that I believe is quite simple to resolve, but my excel's skills are too naive for it. I tried to find a solution online but I did not have any success. Luckily I found this forum, so I decided to give it a try

    I have an online web store that sells perfumes. I get stock information sent to me from the suppliers in the forms of excel sheets in CSV format. I have my own excel sheets of course which are in xlsx and I update the information regularily. My job is becoming more tiring as my stock in increasing, so is the time required for maintaining its information such as prices, quantity, etc... I decided that I should begin automating my work (so far so good, I managed to achieve most of the tasks I wanted to do and I am quite surprised with myself, I guess it is all part of the learning process).

    So, I began learning how to link the data I am getting from my suppliers with my own data. The way I do it is by having two sheets (tabs) in my worksheet file, one is called "MAIN" which is obviously my main work area, and the other sheet is called "WEB" which is the supplier's data that I just copy from their source file and paste to this sheet.

    I thought I figured out how to link data properly by using conditional formating. The format I use is something similar to this: =WEB!$F$4 , where "WEB" is the name of the sheet I am copying from, "F" is the column and "4" is the row of the required cell. Lately I discovered that my supplier is constantly changing the orders of the rows in their excel file, which made my work useless. I need to figure out a way to link the data to their relevant destination in my main file regardless of the changes the supplier is making. The only way I think could work is if I could take advantage of the unique identification number. Both me and my supplier are using exactly the same numbers, which are also known as SKU (Stock Keeping Unit). These numbers never change in our files despite the changes happening in the orders and locations of rows in supplier's data.

    I have attached two photos for you to explain what I am doing. These images represent my "MAIN" sheet and "WEB" sheet which are both inside the same sample excel file. In "MAIN" sheet you will see an example of a perfume I am selling, called Rococo Rouge, and you will see the SKU number of this perfume in the yellow area underlined by two red lines as well as Fixed Cost Price ("Fx Cost" column) which is the data I am copying from the supplier's web sheet. As you can see in the photo (circled in red) above, I am using the formula I told you about, inside the "Fx Cost" cell. The second photo is the "WEB" sheet from the supplier, there you will find four perfumes in which one of them is the same Rococo perfume in my main sheet, you can tell which one it is by looking at the value in column A which is the same unique SKU number that I am using (451034), pointing at it with a red arrow. You will also see the value of the price that I am copying to my other sheet (circled in red) which is the one I need to exactly match regardless of any changes in file. For this example the location of the data for this particular perfume is F4, but unfortunately it is not always going to exactly be in the same spot. The column F never changes, but the rows are always changing, so today it is F4, tomorrow it might become F10 and after tomorrow it could become F55, I will never know!

    1-MAIN.png

    ______________________________________________________________________

    2-WEB.png

    To summarize: Here is my vision of what I want to achieve:

    * Copy data from "WEB" to "MAIN" where the column is F and the cell is in the row that has the value of "451034" in column A *

    I hope that I made my points clear and I am very very thankful for all the help I could get from you. I am even thinking about subscribing to add some paid points in order to get a professional support, but I thought that my query might be too simple that somebody in the free forum could solve it for me easily, therefore I made my mind that I should try the free forum first before spending some money on a paid support that I may not really need.

    I wish you all, my best regards.
    Zed.
    Last edited by unitedscentdom; 02-23-2015 at 03:39 AM. Reason: Editing some typo errors.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to copy data cells from one sheet to another based on unique identifier

    Welcome to the forum
    Here one workbook often means more than 100 pictures (see some other advice and requirements in our http://www.excelforum.com/forum-rule...rum-rules.html ) .

    As for the merit - try in your main sheet cell F2 the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    which looks in column A in Web for mainA2 content and returns value from sixht column in Web (false means exact match in column A)
    Last edited by Kaper; 02-23-2015 at 04:11 AM.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    02-23-2015
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Need to copy data cells from one sheet to another based on unique identifier

    Dear Sir,

    Thank you very much for your wonderful support.

    Even though I haven't tried your solution yet, I am just trying first of all to understand it. I read your explanation to the code and what it means, and I believe I understood most of it. However, I am still puzzled with the following:

    - When using A2, this assumes the data is within row number 2, right? But how could it be useful if the rows are changing? There is clearly something that I don't understand here.

    - The code F$1000, what does it stand for? Is this where I should replace the number 1000 with the proper SKU?

    I have uploaded the sample excel file here, please take a look. Thank you a lot.
    Cheers,

    Z
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-23-2015
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Need to copy data cells from one sheet to another based on unique identifier

    To clarify my questions again, here are some more comments in regards to that number (1000):

    - What would happen if I change number 1000 to any other number such as 900 or 544747, would it still work? what if the number matches an SKU number? would it be affected by it?

    - Do I have to change anything in this code with any other row I am creating in the MAIN sheet for new SKU items, or should I just stick with it?

    Thank you.

    Z

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to copy data cells from one sheet to another based on unique identifier

    this 1000 was last row number with data in WEB sheet
    But as you have excel 2013 you do not have to worry much about last row and can address whole columns so:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    would work equally well.

    As a matter of fact you probably want to add some more SKUs in column A so let's improve this a bit to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Now you can copy this cell it down, even if there is no data in A3 and below

    See attached sample with updated formulas. (not only F2, look into G2, Q2 and S2 - and think whichever is propper approach - roundup I used or just ROUND
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-23-2015
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Need to copy data cells from one sheet to another based on unique identifier

    YES, PERFECT! The second formula (starting with =IF) is exactly what I have been looking for! A conditional formula that allows me to type in any SKU number I want to secure, so that the code will be bulletproof!

    Kaper, you are the EXCEL MASTER. THANK YOU :D

  7. #7
    Registered User
    Join Date
    02-23-2015
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Need to copy data cells from one sheet to another based on unique identifier

    Alright, I still have something that I need to learn about. You see in the improved formula, you have: A2="","" and I can see there are two blanks for data input. Why would I need two if I only need to fill in one SKU for each line? Lets presume that I have SKU number 54545, can I just type the code as: A2="54545" followed by the rest of the code, or should I keep one blank such as: A2="54545","" or A2="","54545" followed by the rest of the code as well?

  8. #8
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to copy data cells from one sheet to another based on unique identifier

    just one blank.

    let me write it other way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    can you see it better now?
    ---------------------------------------------
    Or let's take the previous formula and "disassemble it":

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    formula IF always follow the pattern
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    so we check whether
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    if it is true the result of the whole formula will be
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    if the result of checking will be false (so A2 is not empty) then result of the whole formula will be result of our desired formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-23-2015
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Need to copy data cells from one sheet to another based on unique identifier

    The problem has been fixed. How can I mark this thread as solved?

  10. #10
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to copy data cells from one sheet to another based on unique identifier

    Glad to see it worked, for you. And thanks for marking thread as solved, as well as for reputation point.

    Have a good day!

+ 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: 11
    Last Post: 07-10-2014, 01:56 PM
  2. Replies: 5
    Last Post: 03-12-2013, 08:23 PM
  3. Replies: 5
    Last Post: 04-13-2012, 10:50 PM
  4. Combine rows of data into 1 cell based on unique identifier
    By jud_goh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2010, 05:06 PM
  5. Replies: 1
    Last Post: 12-07-2009, 07:02 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