Data Manipulation

henryg

Board Regular
Joined
Oct 23, 2008
Messages
155
Office Version
  1. 365
Platform
  1. Windows
I have a general ledger listing (csv) from which I wish to recreate a transaction audit trail (ultimately in numerical transaction number) - yes, it should be easily available but the software concerned will not provide it, go figure! An extract is below; sorry I cannot get xl2bb to work, so copied via Word.

I have tried messing around in Power Query, but ultimately failed.

What I want is eg

Account # Date Debit Credit
000 92 22/04/2024 399.00
....
110 20 03/08/2023 800.00
...
130 1 24/09/2022 10.00
etc

I have included only the first item for each of the three accounts but want everything per account.

Any other information I can get via lookup, and then I can sort by trans no.

Data extract

000Equipment
#Date
Debit
Credit
92
22/04/2024
399.00
133
29/10/2024
143.61
135
07/11/2024
282.00
Balance:
824.61
110
#Date
Debit
Credit
20
03/08/2023
800.00
18
03/08/2023
450.00
19
03/08/2023
450.00
24
31/08/2023
1,250.00
37
31/10/2023
450.00
Balance:
-
130Bank
#Date
Debit
Credit
1
24/09/2022
10.00
2
15/10/2022
4,783.30
3
19/10/2022
178.20
4
21/11/2022
1,577.52
5
06/12/2022
376.20
6
14/02/2023
247.50
7
28/02/2023
267.30
8
14/03/2023
178.20
9
28/03/2023
178.20
 
Try:
Book1
ABCDEFGHI
10Equipment
2#DateDebitCredit924/22/24399.00
3924/22/24399.0013310/29/24143.61
413310/29/24143.6113511/7/24282.00
513511/7/24282.00208/3/23800.00
6188/3/23450.00
7Balance:824.61198/3/23450.00
8248/31/231,250.00
93710/31/23450.00
1019/24/2210.00
11110210/15/224,783.30
12#DateDebitCredit310/19/22178.20
13208/3/23800.00411/21/221,577.52
14188/3/23450.00512/6/22376.20
15198/3/23450.0062/14/23247.50
16248/31/231,250.0072/28/23267.30
173710/31/23450.0083/14/23178.20
1893/28/23178.20
19Balance:-
20
21
22
23130Bank
24#DateDebitCredit
2519/24/2210.00
26210/15/224,783.30
27310/19/22178.20
28411/21/221,577.52
29512/6/22376.20
3062/14/23247.50
3172/28/23267.30
3283/14/23178.20
3393/28/23178.20
Sheet3
Cell Formulas
RangeFormula
F2:I18F2=FILTER(A1:D33,ISNUMBER(A1:A33)*ISNUMBER(B1:B33))
Dynamic array formulas.
 
Upvote 0
An alternative with power query
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}}),
    #"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type", {{"Date", null}}),
    #"Filtered Rows" = Table.SelectRows(#"Replaced Errors", each ([Date] <> null))
in
    #"Filtered Rows"
 
Upvote 0
=FILTER(A1:D33,ISNUMBER(A1:A33)*ISNUMBER(B1:B33))
Unfortunately, that does not pick up the account codes in eg A1/A11/A23 which effectively need to be "copied down" against the account line entries, but which are in the same column as the transaction numbers. Which is where I could get no further.

I haven't been able to look at the PQ solution yet.
 
Upvote 0
How about this?
Book1
ABCDEFGHIJ
10Equipment0924/22/24399.00
2#DateDebitCredit013310/29/24143.61
3924/22/24399.00013511/7/24282.00
413310/29/24143.61110208/3/23800.00
513511/7/24282.00110188/3/23450.00
6110198/3/23450.00
7Balance:824.61110248/31/231,250.00
81103710/31/23450.00
913019/24/2210.00
10130210/15/224,783.30
11110130310/19/22178.20
12#DateDebitCredit130411/21/221,577.52
13208/3/23800.00130512/6/22376.20
14188/3/23450.0013062/14/23247.50
15198/3/23450.0013072/28/23267.30
16248/31/231,250.0013083/14/23178.20
173710/31/23450.0013093/28/23178.20
18
19Balance:-
20
21
22
23130Bank
24#DateDebitCredit
2519/24/2210.00
26210/15/224,783.30
27310/19/22178.20
28411/21/221,577.52
29512/6/22376.20
3062/14/23247.50
3172/28/23267.30
3283/14/23178.20
3393/28/23178.20
Sheet3
Cell Formulas
RangeFormula
F1:J17F1=LET(a,A1:A33,b,B1:B33,d,A1:D33,FILTER(HSTACK(MAP(a,LAMBDA(m,INDEX(a,XMATCH("#",A1:m,,-1)-1))),d),ISNUMBER(b)*ISNUMBER(a)))
Dynamic array formulas.
 
Upvote 0
=LET(a,A1:A33,b,B1:B33,d,A1:D33,FILTER(HSTACK(MAP(a,LAMBDA(m,INDEX(a,XMATCH("#",A1:m,,-1)-1))),d),ISNUMBER(b)*ISNUMBER(a)))
Wow the output looks perfect!!

I'll work through the formula as I want to understand it and I don't know MAP() apart from its existence. And of course I will need to amend it to take account of the proper data size/range, but on a quick play it seems I can use a range much bigger than anything I need and it works, if slightly slowly which is ok.

Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,226,875
Messages
6,193,455
Members
453,801
Latest member
777nycole

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