Last Transaction

Harini1100

New Member
Joined
Mar 5, 2024
Messages
22
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
Hello Team,

Need help to find the recent transaction date and sale count from the input value. Please advise,

1718994383950.png
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
In 365:

Excel Formula:
=TAKE(SORT(FILTER(B3:C7,A3:A7=E3)),-1)
 
Upvote 0
Solution
Hi Harini,
if you like vba based on your OP
VBA Code:
Sub Copylast_row()
Dim strUserResponse As String
Dim lastrow As Long
Dim lr As Long
Dim lr1 As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row 
lr = Cells(Rows.Count, 2).End(xlUp).Row
lr1 = Cells(Rows.Count, 3).End(xlUp).Row
ActiveSheet.Range("E3").Value = ActiveSheet.Range("A" & ActiveSheet.Range("A" & Rows.Count).End(3).Row).Value
ActiveSheet.Range("F3").Value = ActiveSheet.Range("B" & ActiveSheet.Range("B" & Rows.Count).End(3).Row).Value
ActiveSheet.Range("G3").Value = ActiveSheet.Range("C" & ActiveSheet.Range("C" & Rows.Count).End(3).Row).Value
End Sub


before
TB.xlsm
ABCDEFG
1
2UNITDATESALE COUNTUNITDATESALE COUNT
3A5/1/2024123
4A5/20/20241100
5A6/5/2024901
6A6/15/2024552
7A6/20/20241800
SH



after
TB.xlsm
ABCDEFG
1
2UNITDATESALE COUNTUNITDATESALE COUNT
3A5/1/2024123A20/6/20241800
4A5/20/20241100
5A6/5/2024901
6A6/15/2024552
7A6/20/20241800
SH


and don't merge cells in row 1 avoid error in the code , next time use XL2BB tool to show where start data from .
 
Upvote 0
Thanks for Awesome response, Unfortunately I need formula only for 365,

@hagia_sofia - =TAKE(SORT(FILTER(B3:C7,A3:A7=E3)),-1) This is working fine, could you please do little modification for the below request, This input is the original format from one of my PATHETIC software. I shown the example of only 2 invoice, but i'm dealing with n number of invoices on daily basis. Kindly help.

1719058398974.png
1719058398974.png
 
Upvote 0
This seems to work. Try
Book1
ABCDEFGHIJKLMNO
1Invoice#DateProductOp QuantityClosing QuantityMsg. DateMessageInvoice#DateProductOp QuantityClosing QuantityMsg. DateMessage
2123412/1/23Rubber10050--123412/1/23Rubber100502/16/24DSL
31/5/24ABC123412/1/23Clamp5006332/20/24OKO
41/12/24DEF18951/9/24Shaft2283/18/24QWE
51/19/24SDAF
61/26/24WRW
72/2/24GHF
82/9/24GERT3
92/16/24DSL
10123412/1/23Clamp500633--
111/9/24DCDF
121/16/24UIO
131/23/24DSFJL
141/30/24DCLDM
152/6/24R234
162/13/24ASCDA
172/20/24OKO
1818951/9/24Shaft228--
192/5/24MKN
202/12/24SDF
212/19/24CIJ
222/26/24WE
233/4/24DCO
243/11/24MKD
253/18/24QWE
Sheet4
Cell Formulas
RangeFormula
I2:M4I2=FILTER(A2:E25,A2:A25<>"")
N2:O4N2=LET(a,$A$2:$A$25,b,B$2:$B$25,c,$C$2:$C$25, d,IF(a="",SEQUENCE(ROWS(a))), x,XMATCH(1,(a=I2)*(b=J2)*(c=K2)), CHOOSEROWS($F$2:$G$25,IFERROR(x-1+XMATCH(FALSE,DROP(d,x)),ROWS(a))))
Dynamic array formulas.
 
Upvote 0
Simplified a little bit more.
Book1
IJKLMNO
1Invoice#DateProductOp QuantityClosing QuantityMsg. DateMessage
2123412/1/23Rubber100502/16/24DSL
3123412/1/23Clamp5006332/20/24OKO
418951/9/24Shaft2283/18/24QWE
Sheet4
Cell Formulas
RangeFormula
I2:M4I2=FILTER(A2:E25,A2:A25<>"")
N2:O4N2=LET(a,$A$2:$A$25,b,B$2:$B$25,c,$C$2:$C$25,f,$F$2:$G$25, x,XMATCH(1,(a=I2)*(b=J2)*(c=K2)), CHOOSEROWS(f,IFERROR(x-1+XMATCH(FALSE,DROP(a="",x)),ROWS(a))))
Dynamic array formulas.
 
Upvote 0
One more option as a single spill range.
Book1
IJKLMNO
1Invoice#DateProductOp QuantityClosing QuantityMsg. DateMessage
2123412/1/23Rubber100502/16/24DSL
3123412/1/23Clamp5006332/20/24OKO
418951/9/24Shaft2283/18/24QWE
Sheet4
Cell Formulas
RangeFormula
I2:O4I2=LET( a,A2:A25<>"",b,A2:E25,c,F2:G25,r,ROWS(a), HSTACK(FILTER(b,a),CHOOSEROWS(c,VSTACK(DROP(TOCOL(IFS(a,SEQUENCE(r)),2),1)-1,r))))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,224
Members
453,025
Latest member
Hannah_Pham93

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