#1
|
|||
|
|||
Search and Paste for accounts on 2 sheets
I have two worksheets, one contains accounts with yearly columns and the other sheet contains accounts with total money spent.
Sheet 1: account-------------2015----------2016-----------2017 112 113 114 115 sheet 2: account-------------total 112----------------50 113----------------100 115----------------15 Now I need for excel to check sheet 1 and find a match in sheet 2 and copy the value from sheet 2 into sheet 1. So for this example sheet under the 2015 column on sheet 1 112,113, & 115 would have values but 114 would be skipped. Here is the psuedocode I have completed so far. Sub () worksheets("sheet 1").range("A1")=n <vendor names with year comparison> worksheets("sheet 2").range("A1")=m <vendor names with amount spent> worksheets("sheet 2").range("B1")=p <amount spent on vendor> worksheets("sheet 1").range("B1")=q <2015 year column> If n=m then copy p paste q else If n=m+1 then copy p+1 paste q+1 until worksheets("sheet 2").range("A208") If n+1=m then copy p paste q+1 else If n+1=m+1 then copy p+1 paste q+1 until worksheets("sheet 2").range("A208") Repeat until n+1=worksheets("sheet 1").range("B2121") end Any help is appreciated. |
#2
|
|||
|
|||
No need for code at all - a SUMIFS formula is enough.
I can't give the specific formula jet, as obviously some essential information is missing. P.e. there must be some column with year or date in Sheet 2 - otherwise amounts for all years of specific account will be same. And what are vendors in your code - accounts or something else? |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
search multiple sheets and create list from found rows | trevorc | Excel Programming | 1 | 01-05-2017 06:24 PM |
Six email accounts under Outlook 2007. One or six Microsoft Accounts at the server?? | BudVitoff | Outlook | 1 | 07-02-2016 08:45 PM |
Range COPY paste in workbooks sheets as variable | Fean | Excel Programming | 3 | 06-07-2016 06:51 AM |
Confused about office accounts vs microsoft accounts (& switching from Pro subscription to edu) | memoid | OneNote | 1 | 06-20-2015 04:13 AM |
Macro help - search for value, paste a value in another column | IRollman | Excel Programming | 1 | 01-14-2014 01:05 PM |