Populate data based on matching last part with sheet name across sheets

Ali M

Active Member
Joined
Oct 10, 2021
Messages
304
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi
in DAILY sheet I have items contains sheet name in last part example (FROM ALI , FROM OMAR ,....)
and I have sheets names ALI and OMAR so I want matching in last PART in the item in column B with sheets names based on DATE & AMOUNT together even duplicates the same amount and date for the same name should brings . if I have the items in DAILY sheet for CUSTOMER NAME doesn't exist in CUSTOMER sheet based on matching date, amount and last part the item with sheet name then should copy to sheet is relation of it as in rows (2,3,5,78,9) in DAILY sheet (those are not existed in ALI, OMAR sheet ) so should add to them and delete FROM ALI, FROM OMAR) , I don't need it to show in customers sheets .
if I have the items in CUSTOMERS sheets and don't existed in DAILY sheet as in row3 for OMAR sheet and rows (4,5,6) in ALI sheet, then should copy to DAILY sheet and add in last part of the ITEM "FROM ALI, FROM OMAR based on matching date, amount and last part the item with sheet name .
any item doesn't contain the sheet name in last part in DAILY sheet should ignore it and any word "OPENING BALANCE" also should ignores from customers sheets when matching.
every time I add new sheets and change data in all of sheets so should update every time run the macro.

copy (3) (1).xlsm
ABCDE
220/06/2023PURCHASE FROM OMAR15,000.0015,000.00
321/06/2023CASH PR FROM ALI15,000.0030,000.00
421/06/2023STOCK1100,000.00130,000.00
522/06/2023CASH DM FROM ALI37,000.0093,000.00
622/06/2023EXPENSE ADMIN65,000.0028,000.00
722/06/2023PURCHASE RETURNS FROM OMAR14,000.0014,000.00
822/06/2023PURCHASE RETURNS FROM ALI3,200.0010,800.00
922/06/2023PURCHASE RETURNS FROM ALI3,200.007,600.00
1022/06/2023PURCHASE LOW 6,200.0013,800.00
1122/06/2023EXPENSE PR37,000.0050,800.00
1222/06/2023SALES201,000.00-150,200.00
1322/06/2023SALES RETURNS3,500.00-146,700.00
1423/06/2023SELLING LOW 3,201.00-149,901.00
1524/06/2023SALES FROM OMAR3,202.00-153,103.00
DAILY
Cell Formulas
RangeFormula
E2E2=C2-D2
E3:E15E3=E2+C3-D3




copy (3) (1).xlsm
ABCDE
1ITEMACCOUNT NAMEDEBIT CREDITBALANCE
220/06/2023OPENING BALANCE SALES15,000.0015,000.00
322/06/2023PURCHASE RETURNS4,000.0011,000.00
424/06/2023SALES 3,202.007,798.00
5TOTAL15,000.007,202.007,798.00
OMAR
Cell Formulas
RangeFormula
E2,E5E2=C2-D2
E3:E4E3=E2+C3-D3
C5:D5C5=SUM(C2:C4)



copy (3) (1).xlsm
ABCDE
1DATEACCOUNT NAMEDEBIT CREDITBALANCE
220/06/2023OPENING BALANCE PURCHASE200,000.00200,000.00
321/06/2023CASH PR 15,000.00215,000.00
422/06/2023CASH DM30,000.00185,000.00
523/06/2023CASH DM1,200.00183,800.00
623/06/2023CASH DM1,200.00182,600.00
7TOTAL215,000.0032,400.00182,600.00
ALI
Cell Formulas
RangeFormula
E2,E7E2=C2-D2
E3:E6E3=E2+C3-D3
C7:D7C7=SUM(C2:C6)



result in daily sheet as show in rows (6,7,8,10) brought from customers sheets.
copy (3) (1).xlsm
ABCDE
1DATEACCOUNT NAMEDEBIT CREDITBALANCE
221/06/2023CASH PR FROM ALI1500015000
321/06/2023CASH PR FROM ALI1500030000
422/06/2023CASH DM FROM ALI37000-7000
522/06/2023EXPENSE ADMIN65000-72000
622/06/2023CASH DM FROM ALI30000-102000
723/06/2023CASH DM FROM ALI1200-103200
823/06/2023CASH DM FROM ALI1200-104400
920/06/2023PURCHASE FROM OMAR15000-89400
1022/06/2023PURCHASE RETURNS FROM OMAR4000-93400
1121/06/2023STOCK110000010600
1222/06/2023PURCHASE RETURNS FROM OMAR14000-3400
1322/06/2023PURCHASE LOW 62002800
1422/06/2023EXPENSE PR3700039800
1522/06/2023SALES201000-161200
1622/06/2023SALES RETURNS3500-157700
1722/06/2023PURCHASE RETURNS FROM ALI3200-160900
1822/06/2023PURCHASE RETURNS FROM ALI3200-164100
1923/06/2023SELLING LOW 3201-167301
2024/06/2023SALES FROM OMAR3202-170503
DAILY
Cell Formulas
RangeFormula
E2E2=C2-D2
E12:E20,E3:E10E3=E2+C3-D3
E11E11=E9+C11-D11




result in OMAR sheet as shows in rows 3,4 brought from DAILY sheet.

copy (3) (1).xlsm
ABCDE
1ITEMACCOUNT NAMEDEBIT CREDITBALANCE
220/06/2023OPENING BALANCE SALES15,000.0015,000.00
320/06/2023PURCHASE15,000.0030,000.00
422/06/2023PURCHASE RETURNS14,000.0016,000.00
522/06/2023PURCHASE RETURNS4,000.0012,000.00
624/06/2023SALES 3,202.008,798.00
7TOTAL30,000.0021,202.008,798.00
OMAR
Cell Formulas
RangeFormula
E2,E7E2=C2-D2
E3:E6E3=E2+C3-D3
C7:D7C7=SUM(C2:C6)



result in ALI sheet as in rows (4,5,6,7) brought from DAILY sheet

copy (3) (1).xlsm
ABCDE
1DATEACCOUNT NAMEDEBIT CREDITBALANCE
220/06/2023OPENING BALANCE PURCHASE200,000.00200,000.00
321/06/2023CASH PR 15,000.00215,000.00
421/06/2023CASH PR15,000.00230,000.00
522/06/2023CASH DM37,000.00193,000.00
622/06/2023PURCHASE RETURNS3,200.00189,800.00
722/06/2023PURCHASE RETURNS3,200.00186,600.00
822/06/2023CASH DM30,000.00156,600.00
923/06/2023CASH DM1,200.00155,400.00
1023/06/2023CASH DM1,200.00154,200.00
11TOTAL230,000.0075,800.00154,200.00
ALI
Cell Formulas
RangeFormula
E2,E11E2=C2-D2
E3:E10E3=E2+C3-D3
C11:D11C11=SUM(C2:C10)



thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
The macro can run through column B and check for "FROM" in the cell content using for instance :
VBA Code:
    for lR = 1 to lLastRow
        If Sheets("DAILY").Cells(2,lR) Like "*FROM*" Then
            sName = trim(Right(Sheets("DAILY").Cells(2,lR), RevInstr(Sheets("DAILY").Cells(2,lR)," ",99))
'Then find the sheet with name sName and add the data to the bottom
 
Upvote 0

Forum statistics

Threads
1,222,830
Messages
6,168,509
Members
452,194
Latest member
Lowie27

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top