Merge partial character before specific word across sheets based on headers

Amer Omar

New Member
Joined
Jan 27, 2024
Messages
18
Office Version
  1. 2019
Platform
  1. Windows
Hi,
I want merge data based on matching headers across sheets .
if the cells B4,C4 are empty then should match header(DETAILES) and merge amounts for column TOTAL based on partial character before word "NO"
if the cells B4,C4 are DATES then should match headers(DATE,DETAILES) and merge amounts for column TOTAL based on before word "NO"
as you see the structure for each sheet is not the same . so that's why I would match headers.
so the result will be in RESULT sheet .
in row 7 will be headers from column C based on sheets names and will merge based on two cases as I mentioned also insert total row to sum each column .
I would macro to deal with big data for each sheet , I will add new sheets every time before RESULT sheet . so before bring report should delete data in RESULT sheet.
AM (1).xlsm
ABCDE
1ITEMDATEDETAILESREFTOTAL
2111/11/2023SALES INVOICE NO 123333REE12,000.00
3211/11/2023SALES INVOICE NO 123333REE23,000.00
4311/11/2023SALES INVOICE NO 123333REE22,500.00
5411/11/2023SALES INVOICE NO 123333REE21,200.00
6511/11/2023SALES INVOICE NO 123333REE31,300.00
7611/11/2023SALES INVOICE NO 123333REE1210.00
8711/11/2023SALES INVOICE NO 123333REE11,310.00
9811/11/2023SALES INVOICE NO 123333REE11,220.00
10911/11/2023SALES INVOICE NO 123333REE31,110.00
11TOTAL13,850.00
12111/11/2023SALES INVOICE NO 123334REE32,000.00
13211/11/2023SALES INVOICE NO 123334REE43,000.00
14311/11/2023SALES INVOICE NO 123334REE52,500.00
15TOTAL7,500.00
16111/11/02024SALES INVOICE NO 123334REE32,000.00
17211/11/02024SALES INVOICE NO 123334REE43,000.00
18TOTAL5,000.00
19111/11/02024SALES INVOICE NO 123334REE34,000.00
20211/11/02024SALES INVOICE NO 123334REE65,000.00
21TOTAL9,000.00
SAELS
Cell Formulas
RangeFormula
E11E11=SUM(E2:E10)
E15E15=SUM(E12:E14)
E18,E21E18=SUM(E16:E17)



AM (1).xlsm
BCDEF
1ITEMDATEDETAILESREFTOTAL
2111/11/2023PURCHASE INVOICE NO PR199000PPRT11,000.00
3211/11/2023PURCHASE INVOICE NO PR199000PPRT212,000.00
4311/11/2023PURCHASE INVOICE NO PR199000PPRT320,000.00
5411/11/2023PURCHASE INVOICE NO PR199000PPRT430,000.00
6511/11/2023PURCHASE INVOICE NO PR199000PPRT54,000.00
7611/11/2023PURCHASE INVOICE NO PR199000PPRT650,000.00
8711/11/2023PURCHASE INVOICE NO PR199000PPRT71,000.00
9TOTAL118,000.00
10111/01/2024PURCHASE INVOICE NO PR199001PPRT71,200.00
11211/01/2024PURCHASE INVOICE NO PR199001PPRT81,300.00
12TOTAL2,500.00
13111/01/2024PURCHASE INVOICE NO PR199002REE32,000.00
14211/01/2024PURCHASE INVOICE NO PR199002REE43,000.00
15TOTAL5,000.00
PURCHASES
Cell Formulas
RangeFormula
F9F9=SUM(F2:F8)
F12,F15F12=SUM(F10:F11)



AM (1).xlsm
CDEFGH
1ITEMDATEDETAILSDEBITCREDITTOTAL
2101/01/2023PUFF PASW NO MM0011,100.001,100.00
3202/01/2023PUFF PASW NO MM0021,000.001,000.00
4303/01/2023MUFF SASW NO MM0032,000.001,100.00900.00
5404/01/2023PUFF PASW NO MM0041,200.001,200.00
6505/01/2023ZUFF ZASW NO MM0051,200.001,200.00
7606/01/2023PUFF PASW NO MM0062,000.001,000.001,000.00
8707/01/2024PUFF PASW NO MM0072,100.001,001.001,099.00
9808/01/2024PUFF PASW NO MM0082,120.001,002.001,118.00
10909/01/2024PUFF PASW NO MM0091,000.00200.00800.00
PDD
Cell Formulas
RangeFormula
H2:H10H2=F2-G2


AM (1).xlsm
CDEFGH
1ITEMDATEDETAILSDEBITCREDITTOTAL
2101/01/2023RCC VCH NO VM122222,000.002,000.00
3202/01/2023RCC VCH NO VM122233,000.003,000.00
4303/01/2023RCC VCH NO VM122242,100.002,100.00
5404/01/2023RCC VCH NO VM122251,200.001,200.00
6505/01/2023RCC VCH NO VM122261,200.001,200.00
7606/01/2023VRTC VCH NO 20002,000.001,000.001,000.00
8707/01/2023RCC VCH NO VM122272,200.002,200.00
9808/01/2024VRTC VCH NO 20012,000.001,500.00500.00
10908/01/2024RCC VCH NO VM122282,000.002,000.00
111008/01/2024VRTC VCH NO 20021,200.001,100.00100.00
121108/01/2024VRTC VCH NO 20031,300.001,200.00100.00
PAID
Cell Formulas
RangeFormula
H2:H12H2=F2-G2




before
AM (1).xlsm
ABCDEF
3FROM DATETO DATE
4
5
6
7
8
9
10
11
12
13
14
15
RESULT

when B4,C4 are empty
AM (1).xlsm
ABCDEF
3FROM DATETO DATE
4
5
6
7ITEMDESCRIBESAELSPURCHASESPAIDPDD
81PURCHASE INVOICE-125,500.00--
92SALES INVOICE35,350.00---
103RCC VCH--13,700.00-
114VRTC VCH--1,700.00-
125PUFF PASW---7,137.00
136MUFF SASW---900.00
147ZUFF ZASW---1,200.00
15TOTAL35,350.00125,500.0015,400.009,237.00
RESULT
Cell Formulas
RangeFormula
C15:F15C15=SUM(C8:C14)



when B4,C4 contains dates
AM (1).xlsm
ABCDEF
3FROM DATETO DATE
401/01/202312/11/2023
5
6
7ITEMDESCRIBESAELSPURCHASESPAIDPDD
81PURCHASE INVOICE-118,000.00--
92SALES INVOICE21,350.00---
103RCC VCH--11,700.00-
114VRTC VCH--1,000.00-
125PUFF PASW---4,300.00
136MUFF SASW---900.00
147ZUFF ZASW---1,200.00
15TOTAL21,350.00118,000.0012,700.006,400.00
RESULT
Cell Formulas
RangeFormula
C15:F15C15=SUM(C8:C14)

thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hello.

The cell "F12" of sheet "Result" when B4,C4 are empty should not be "7,137.00".
It's supposed to be "7,317.00".

Good luck.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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