Difficult to say, best attach your actual workbook with code so that we know where all this code is.
At first glance, and a big guess, there's a line:
lastRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
which might well cause such an error since ws hasn't been set at the point it's being used...
Power Query solution in the attached.
Note only raw data in the source table on the left. Play with adjusting the numbers in that table (I played with the red highlighted ones) then right-click somewhere on the right hand table and chose Refresh to get an updated, sorted snfd rsnked results...
Not a vba solution in the attached but…
A formula in cell AC2:
=LET(res,C2:AA2,seq,SEQUENCE(,COLUMNS(res)/2),LARGE(res,seq)+SMALL(res,seq))which can be copied down.
This formula spills to the right. I've added headers in row 1 to give an idea o what each column represents:
H+L_1 is the 1st...
H1: The first part of that question is Time wasters, so based on duration of calls the 4 worst (in order) are
C0010
C0014
C0008
C0003
The second part of H1 is which customers call most, so based on the number of calls the 4 worst (in order) are
C0008
C0010
C0002
C0014...
Not sure if you already have your answer but try in cell D6:=SUMPRODUCT(($E$4:$BI$4<>"")/COUNTIF($E$4:$BI$4,$E$4:$BI$4&"")*($E6:$BI6="Y"))and copy down. Test thoroughly; I haven't.
Maybe:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim DVCells As Range
Set DVCells = Intersect(Target, Range("Tabela13[Status]"))
If Not DVCells Is Nothing Then
On Error Resume Next
Me.Unprotect
For Each cll In DVCells
Select Case cll.Value
Case "A": VD = "B"
Case "B"...
You could do something like:
=INDIRECT("Sheet2!" & CELL("address", C2))
but I don't see the point, why not just have:
=Sheet2!C2
and copy that down and across?
Or a single cell which spills:
=Sheet2!C2:E5
Another macro approach: A one liner:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G3:I3")) Is Nothing Then Range("B4:D19").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("G1:I2"), CopyToRange:=Range("G4:I4"), Unique:=False
End Sub
It uses...
I can do this in Power Query but I'm not good enough with DAX to do it in DAX; would this be any use?
Also note that I've added a few test rows to your source data, is the result above what you're wanting (especially the last row)?
1. I can see that one condition is Transaction Type being "Purchase" but I can't determine the 2nd condition; what is it?
2. What version of Excel are you using?
See query table at cell A22 of the query sheet.
You don't really need the right-most column since, by definition, it's a repeat of the CHEQUE AMOUNT column.
You're looking at whole columns in 14 sheets. I don't imagine you have about 1 million rows of data in each month. In the following formula, still inefficient, I've assumed 100 rows per month, and that you have a version of Excel with the functions LET, CHOOSECOLS, TAKE and VSTACK. It should...
No I really need a link to a workbook.
A complete guess from your picture:=ARRAYFORMULA(IF(O3:O<>$W$1,"-", IF(P3:P = "", "", IF(ISNUMBER(MATCH($W$1 & P3:P & O3:O, $S$1 & K3:K & J3:J, 0)), "Received", "Missing"))))
It seems to work all right, so the problem is what is the 'correct' result?
Difficult to know what needs putting right from something which is giving the wrong result.
Probably best to give us some data along with the expected results somewhere and a bit of narrative explaining what it's...