Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2017, 11:32 AM
Brian13 Brian13 is offline Search and Paste for accounts on 2 sheets Windows 10 Search and Paste for accounts on 2 sheets Office 2010 64bit
Novice
Search and Paste for accounts on 2 sheets
 
Join Date: May 2017
Posts: 2
Brian13 is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 06-05-2017, 09:59 PM
ArviLaanemets ArviLaanemets is offline Search and Paste for accounts on 2 sheets Windows 8 Search and Paste for accounts on 2 sheets Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

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?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Paste for accounts on 2 sheets search multiple sheets and create list from found rows trevorc Excel Programming 1 01-05-2017 06:24 PM
Search and Paste for accounts on 2 sheets Six email accounts under Outlook 2007. One or six Microsoft Accounts at the server?? BudVitoff Outlook 1 07-02-2016 08:45 PM
Search and Paste for accounts on 2 sheets Range COPY paste in workbooks sheets as variable Fean Excel Programming 3 06-07-2016 06:51 AM
Search and Paste for accounts on 2 sheets Confused about office accounts vs microsoft accounts (& switching from Pro subscription to edu) memoid OneNote 1 06-20-2015 04:13 AM
Search and Paste for accounts on 2 sheets Macro help - search for value, paste a value in another column IRollman Excel Programming 1 01-14-2014 01:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft