Export some data if a condition is met.

harzer

Board Regular
Joined
Dec 15, 2021
Messages
161
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,
I managed to write a code to find a solution to my problem (the solution I wrote is very basic), but unfortunately it is not fast.
The goal of this code is to export all the values that are less than 0.25 and that are in the range ("M3: AF23"), this Range is variable in line (Horizontally) and in column (Vertically).
What we know about this range is that it always starts at "M3" but we do not know its last column and its last line, hence the need to determine them.
When we find a value < 0.25, we will look for the value that is in the same row of column "L" and will also look for the value that is in the same column in row 2
Let's take an example:
Let's look at the value of the first cell of the Range, it is the cell "M3" which is equal to 8%, it is less than 0.25, so we will retrieve the cell of the same row in column "L" (=ABE27-022/2022 M) and will also retrieve the value of the cell of the same column in row 2 (=ABE27-037/2022 F).
We will do the same for all the cells of the Range ("M3: AF23").
When the data of the Range is not numerous, the Macro works well, the problem is that the macro does not execute quickly when my data is important.
How can you write it so that it is very fast, maybe using arrays like LBound and UBound.
The data in the Range comes from a pivot table, please suggest a solution with a vba code, especially not a solution with power query please.
The desired result is in the columns: ("AH3:AJ390").
Thank you in advance for your contributions.

Here is the code that I have implemented and that I would like to rewrite or improve.

VBA Code:
Sub Exporter_Données()

Dim Sels As Range
Dim Ma_Plage As Range
Dim Cell As Range
Dim Lig_Dest As Long
Dim DerLig As Long
Dim DerCol As Long

Application.ScreenUpdating = False

    DerLig = Range("L" & Rows.Count).End(xlUp).Row
    DerCol = Range("L2").End(xlToRight).Column

    'Effacement des précédentes données
    Range(Cells(3, DerCol + 2), Cells(5000, DerCol + 4)).ClearContents

    Lig_Dest = 3
    Set Ma_Plage = Range(Cells(3, "M"), Cells(DerLig, DerCol))

    For Each Cell In Ma_Plage
        If Cell < 0.25 Then
            Cells(Lig_Dest, DerCol + 2) = Cells(Cell.Row, "L")
            Cells(Lig_Dest, DerCol + 3) = Cells(2, Cell.Column)
            Cells(Lig_Dest, DerCol + 4) = Cell
            Lig_Dest = Lig_Dest + 1
        End If
    Next
Application.ScreenUpdating = True

End Sub

Here is the Range data

copier-ou-transposer-donnees-si.xlsm
LMNOPQRSTUVWXYZAAABACADAEAF
1Mère
2PèreABE27-037/2022 FABE27-038/2022 FABE27-017/2023 FABE27-023/2023 FABE27-026/2022 FNIM96-010/2021 FABE27-012/2024 FABE27-014/2024 FABE27-019/2024 FABE27-023/2024 FABE27-035/2024 FABE27-036/2024 FABE27-044/2024 FABE27-046/2024 FABE27-047/2024 FABE27-060/2024 FABE27-078/23-2024 FABE27-079/23-2024 FNIM96-006/2024 FNIM96-066/2024 F
3ABE27-022/2022 M8,00%8,00%4,50%26,30%7,00%0,90%6,80%7,70%26,30%26,30%7,50%7,50%5,50%28,10%28,10%14,70%29,40%5,50%1,50%1,50%
4ABE27-036/2023 M2,30%2,30%1,70%2,10%4,80%1,10%8,50%1,50%2,10%2,10%3,50%3,50%5,60%2,40%2,40%5,50%3,90%27,30%5,20%5,20%
5ABE27-022/2023 M5,00%5,00%9,80%26,70%4,40%27,00%10,60%11,00%26,70%26,70%4,70%4,70%3,50%18,00%18,00%14,30%15,30%3,50%8,00%8,00%
6ABE27-035/2022 M28,10%28,10%15,10%5,00%6,70%2,00%5,70%28,50%5,00%5,00%28,50%28,50%17,40%11,50%11,50%5,80%7,30%15,20%4,90%4,90%
7LUL59-001/2023 M0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%
8NIM96-020/2023 M6,60%6,60%3,80%2,00%9,60%0,90%5,30%6,40%2,00%2,00%8,10%8,10%28,70%3,40%3,40%26,40%6,30%7,80%14,60%14,60%
9ABE27-007/2024 M2,50%2,50%4,90%25,20%2,20%13,50%5,30%5,50%13,30%13,30%2,30%2,30%1,70%9,00%9,00%13,10%7,70%1,80%4,00%4,00%
10ABE27-067/2024 M2,50%2,50%4,90%13,30%2,20%13,50%5,30%5,50%13,30%13,30%2,30%2,30%1,70%9,00%9,00%7,20%7,70%1,80%4,00%4,00%
11ABE27-016/2024 M17,40%28,40%9,40%3,50%8,10%1,50%5,50%11,90%3,50%3,50%12,80%12,80%23,00%7,50%7,50%16,10%6,80%11,50%9,80%9,80%
12ABE27-017/2024 M17,40%28,40%9,40%3,50%8,10%1,50%5,50%11,90%3,50%3,50%12,80%12,80%23,00%7,50%7,50%16,10%6,80%11,50%9,80%9,80%
13ABE27-042/2024 M17,40%17,40%9,40%3,50%8,10%1,50%5,50%11,90%3,50%3,50%12,80%12,80%28,60%7,50%7,50%16,10%6,80%11,50%9,80%9,80%
14ABE27-043/2024 M17,40%17,40%9,40%3,50%8,10%1,50%5,50%11,90%3,50%3,50%12,80%12,80%28,60%7,50%7,50%16,10%6,80%11,50%9,80%9,80%
15ABE27-033/2024 M17,40%17,40%9,60%4,70%28,30%1,90%7,30%19,50%4,70%4,70%28,40%28,40%12,80%8,60%8,60%6,40%17,90%10,50%5,60%5,60%
16ABE27-055/2024 M2,10%2,10%8,40%8,30%3,30%14,60%8,30%4,80%8,30%8,30%2,70%2,70%3,50%5,20%5,20%6,60%2,60%14,40%9,90%9,90%
17ABE27-006/2024 M15,60%10,00%18,30%18,20%4,30%21,00%8,80%11,90%18,20%18,20%7,10%7,10%6,40%16,80%16,80%10,50%9,80%8,70%8,90%8,90%
18ABE27-057/2024 M5,00%5,00%9,80%26,70%4,40%27,00%10,60%11,00%26,70%26,70%4,70%4,70%3,50%18,00%18,00%14,30%15,40%3,50%8,00%8,00%
19ABE27-009/2024 M4,80%4,80%6,50%15,40%3,90%14,60%18,10%7,00%15,40%15,40%4,30%4,30%4,00%11,40%11,40%9,30%10,10%7,00%5,90%5,90%
20ABE27-010/2024 M4,80%4,80%6,50%15,40%3,90%14,60%18,10%7,00%15,40%15,40%4,30%4,30%4,00%11,40%11,40%9,30%10,10%7,00%5,90%5,90%
21NIM96-100/2024 M0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%0,00%
22NIM96-008/2021 M2,00%2,00%27,60%14,50%1,70%28,10%8,20%8,10%14,50%14,50%1,90%1,90%1,50%14,30%14,30%7,70%1,30%1,50%14,50%14,50%
23ABE27-008/2024 M4,80%4,80%6,50%15,40%3,90%14,60%18,10%7,00%15,40%15,40%4,30%4,30%4,00%11,40%11,40%9,30%10,10%7,00%5,90%5,90%
Couples


The desired result

copier-ou-transposer-donnees-si.xlsm
AHAIAJ
3ABE27-022/2022 MABE27-037/2022 F8,00%
4ABE27-022/2022 MABE27-038/2022 F8,00%
5ABE27-022/2022 MABE27-017/2023 F4,50%
6ABE27-022/2022 MABE27-026/2022 F7,00%
7ABE27-022/2022 MNIM96-010/2021 F0,90%
8ABE27-022/2022 MABE27-012/2024 F6,80%
9ABE27-022/2022 MABE27-014/2024 F7,70%
10ABE27-022/2022 MABE27-035/2024 F7,50%
11ABE27-022/2022 MABE27-036/2024 F7,50%
12ABE27-022/2022 MABE27-044/2024 F5,50%
13ABE27-022/2022 MABE27-060/2024 F14,70%
14ABE27-022/2022 MABE27-079/23-2024 F5,50%
15ABE27-022/2022 MNIM96-006/2024 F1,50%
16ABE27-022/2022 MNIM96-066/2024 F1,50%
17ABE27-036/2023 MABE27-037/2022 F2,30%
18ABE27-036/2023 MABE27-038/2022 F2,30%
19ABE27-036/2023 MABE27-017/2023 F1,70%
20ABE27-036/2023 MABE27-023/2023 F2,10%
21ABE27-036/2023 MABE27-026/2022 F4,80%
22ABE27-036/2023 MNIM96-010/2021 F1,10%
23ABE27-036/2023 MABE27-012/2024 F8,50%
24ABE27-036/2023 MABE27-014/2024 F1,50%
25ABE27-036/2023 MABE27-019/2024 F2,10%
26ABE27-036/2023 MABE27-023/2024 F2,10%
27ABE27-036/2023 MABE27-035/2024 F3,50%
28ABE27-036/2023 MABE27-036/2024 F3,50%
29ABE27-036/2023 MABE27-044/2024 F5,60%
30ABE27-036/2023 MABE27-046/2024 F2,40%
31ABE27-036/2023 MABE27-047/2024 F2,40%
32ABE27-036/2023 MABE27-060/2024 F5,50%
33ABE27-036/2023 MABE27-078/23-2024 F3,90%
34ABE27-036/2023 MNIM96-006/2024 F5,20%
35ABE27-036/2023 MNIM96-066/2024 F5,20%
36ABE27-022/2023 MABE27-037/2022 F5,00%
37ABE27-022/2023 MABE27-038/2022 F5,00%
38ABE27-022/2023 MABE27-017/2023 F9,80%
39ABE27-022/2023 MABE27-026/2022 F4,40%
40ABE27-022/2023 MABE27-012/2024 F10,60%
41ABE27-022/2023 MABE27-014/2024 F11,00%
42ABE27-022/2023 MABE27-035/2024 F4,70%
43ABE27-022/2023 MABE27-036/2024 F4,70%
44ABE27-022/2023 MABE27-044/2024 F3,50%
45ABE27-022/2023 MABE27-046/2024 F18,00%
46ABE27-022/2023 MABE27-047/2024 F18,00%
47ABE27-022/2023 MABE27-060/2024 F14,30%
48ABE27-022/2023 MABE27-078/23-2024 F15,30%
49ABE27-022/2023 MABE27-079/23-2024 F3,50%
50ABE27-022/2023 MNIM96-006/2024 F8,00%
51ABE27-022/2023 MNIM96-066/2024 F8,00%
52ABE27-035/2022 MABE27-017/2023 F15,10%
53ABE27-035/2022 MABE27-023/2023 F5,00%
54ABE27-035/2022 MABE27-026/2022 F6,70%
55ABE27-035/2022 MNIM96-010/2021 F2,00%
56ABE27-035/2022 MABE27-012/2024 F5,70%
57ABE27-035/2022 MABE27-019/2024 F5,00%
58ABE27-035/2022 MABE27-023/2024 F5,00%
59ABE27-035/2022 MABE27-044/2024 F17,40%
60ABE27-035/2022 MABE27-046/2024 F11,50%
61ABE27-035/2022 MABE27-047/2024 F11,50%
62ABE27-035/2022 MABE27-060/2024 F5,80%
63ABE27-035/2022 MABE27-078/23-2024 F7,30%
64ABE27-035/2022 MABE27-079/23-2024 F15,20%
65ABE27-035/2022 MNIM96-006/2024 F4,90%
66ABE27-035/2022 MNIM96-066/2024 F4,90%
67LUL59-001/2023 MABE27-037/2022 F0,00%
68LUL59-001/2023 MABE27-038/2022 F0,00%
69LUL59-001/2023 MABE27-017/2023 F0,00%
70LUL59-001/2023 MABE27-023/2023 F0,00%
71LUL59-001/2023 MABE27-026/2022 F0,00%
72LUL59-001/2023 MNIM96-010/2021 F0,00%
73LUL59-001/2023 MABE27-012/2024 F0,00%
74LUL59-001/2023 MABE27-014/2024 F0,00%
75LUL59-001/2023 MABE27-019/2024 F0,00%
76LUL59-001/2023 MABE27-023/2024 F0,00%
77LUL59-001/2023 MABE27-035/2024 F0,00%
78LUL59-001/2023 MABE27-036/2024 F0,00%
79LUL59-001/2023 MABE27-044/2024 F0,00%
80LUL59-001/2023 MABE27-046/2024 F0,00%
81LUL59-001/2023 MABE27-047/2024 F0,00%
82LUL59-001/2023 MABE27-060/2024 F0,00%
83LUL59-001/2023 MABE27-078/23-2024 F0,00%
84LUL59-001/2023 MABE27-079/23-2024 F0,00%
85LUL59-001/2023 MNIM96-006/2024 F0,00%
86LUL59-001/2023 MNIM96-066/2024 F0,00%
87NIM96-020/2023 MABE27-037/2022 F6,60%
88NIM96-020/2023 MABE27-038/2022 F6,60%
89NIM96-020/2023 MABE27-017/2023 F3,80%
90NIM96-020/2023 MABE27-023/2023 F2,00%
91NIM96-020/2023 MABE27-026/2022 F9,60%
92NIM96-020/2023 MNIM96-010/2021 F0,90%
93NIM96-020/2023 MABE27-012/2024 F5,30%
94NIM96-020/2023 MABE27-014/2024 F6,40%
95NIM96-020/2023 MABE27-019/2024 F2,00%
96NIM96-020/2023 MABE27-023/2024 F2,00%
97NIM96-020/2023 MABE27-035/2024 F8,10%
98NIM96-020/2023 MABE27-036/2024 F8,10%
99NIM96-020/2023 MABE27-046/2024 F3,40%
100NIM96-020/2023 MABE27-047/2024 F3,40%
101NIM96-020/2023 MABE27-078/23-2024 F6,30%
102NIM96-020/2023 MABE27-079/23-2024 F7,80%
103NIM96-020/2023 MNIM96-006/2024 F14,60%
104NIM96-020/2023 MNIM96-066/2024 F14,60%
105ABE27-007/2024 MABE27-037/2022 F2,50%
106ABE27-007/2024 MABE27-038/2022 F2,50%
107ABE27-007/2024 MABE27-017/2023 F4,90%
108ABE27-007/2024 MABE27-026/2022 F2,20%
109ABE27-007/2024 MNIM96-010/2021 F13,50%
110ABE27-007/2024 MABE27-012/2024 F5,30%
111ABE27-007/2024 MABE27-014/2024 F5,50%
112ABE27-007/2024 MABE27-019/2024 F13,30%
113ABE27-007/2024 MABE27-023/2024 F13,30%
114ABE27-007/2024 MABE27-035/2024 F2,30%
115ABE27-007/2024 MABE27-036/2024 F2,30%
116ABE27-007/2024 MABE27-044/2024 F1,70%
117ABE27-007/2024 MABE27-046/2024 F9,00%
118ABE27-007/2024 MABE27-047/2024 F9,00%
119ABE27-007/2024 MABE27-060/2024 F13,10%
120ABE27-007/2024 MABE27-078/23-2024 F7,70%
121ABE27-007/2024 MABE27-079/23-2024 F1,80%
122ABE27-007/2024 MNIM96-006/2024 F4,00%
123ABE27-007/2024 MNIM96-066/2024 F4,00%
124ABE27-067/2024 MABE27-037/2022 F2,50%
125ABE27-067/2024 MABE27-038/2022 F2,50%
126ABE27-067/2024 MABE27-017/2023 F4,90%
127ABE27-067/2024 MABE27-023/2023 F13,30%
128ABE27-067/2024 MABE27-026/2022 F2,20%
129ABE27-067/2024 MNIM96-010/2021 F13,50%
130ABE27-067/2024 MABE27-012/2024 F5,30%
131ABE27-067/2024 MABE27-014/2024 F5,50%
132ABE27-067/2024 MABE27-019/2024 F13,30%
133ABE27-067/2024 MABE27-023/2024 F13,30%
134ABE27-067/2024 MABE27-035/2024 F2,30%
135ABE27-067/2024 MABE27-036/2024 F2,30%
136ABE27-067/2024 MABE27-044/2024 F1,70%
137ABE27-067/2024 MABE27-046/2024 F9,00%
138ABE27-067/2024 MABE27-047/2024 F9,00%
139ABE27-067/2024 MABE27-060/2024 F7,20%
140ABE27-067/2024 MABE27-078/23-2024 F7,70%
141ABE27-067/2024 MABE27-079/23-2024 F1,80%
142ABE27-067/2024 MNIM96-006/2024 F4,00%
143ABE27-067/2024 MNIM96-066/2024 F4,00%
144ABE27-016/2024 MABE27-037/2022 F17,40%
145ABE27-016/2024 MABE27-017/2023 F9,40%
146ABE27-016/2024 MABE27-023/2023 F3,50%
147ABE27-016/2024 MABE27-026/2022 F8,10%
148ABE27-016/2024 MNIM96-010/2021 F1,50%
149ABE27-016/2024 MABE27-012/2024 F5,50%
150ABE27-016/2024 MABE27-014/2024 F11,90%
151ABE27-016/2024 MABE27-019/2024 F3,50%
152ABE27-016/2024 MABE27-023/2024 F3,50%
153ABE27-016/2024 MABE27-035/2024 F12,80%
154ABE27-016/2024 MABE27-036/2024 F12,80%
155ABE27-016/2024 MABE27-044/2024 F23,00%
156ABE27-016/2024 MABE27-046/2024 F7,50%
157ABE27-016/2024 MABE27-047/2024 F7,50%
158ABE27-016/2024 MABE27-060/2024 F16,10%
159ABE27-016/2024 MABE27-078/23-2024 F6,80%
160ABE27-016/2024 MABE27-079/23-2024 F11,50%
161ABE27-016/2024 MNIM96-006/2024 F9,80%
162ABE27-016/2024 MNIM96-066/2024 F9,80%
163ABE27-017/2024 MABE27-037/2022 F17,40%
164ABE27-017/2024 MABE27-017/2023 F9,40%
165ABE27-017/2024 MABE27-023/2023 F3,50%
166ABE27-017/2024 MABE27-026/2022 F8,10%
167ABE27-017/2024 MNIM96-010/2021 F1,50%
168ABE27-017/2024 MABE27-012/2024 F5,50%
169ABE27-017/2024 MABE27-014/2024 F11,90%
170ABE27-017/2024 MABE27-019/2024 F3,50%
171ABE27-017/2024 MABE27-023/2024 F3,50%
172ABE27-017/2024 MABE27-035/2024 F12,80%
173ABE27-017/2024 MABE27-036/2024 F12,80%
174ABE27-017/2024 MABE27-044/2024 F23,00%
175ABE27-017/2024 MABE27-046/2024 F7,50%
176ABE27-017/2024 MABE27-047/2024 F7,50%
177ABE27-017/2024 MABE27-060/2024 F16,10%
178ABE27-017/2024 MABE27-078/23-2024 F6,80%
179ABE27-017/2024 MABE27-079/23-2024 F11,50%
180ABE27-017/2024 MNIM96-006/2024 F9,80%
181ABE27-017/2024 MNIM96-066/2024 F9,80%
182ABE27-042/2024 MABE27-037/2022 F17,40%
183ABE27-042/2024 MABE27-038/2022 F17,40%
184ABE27-042/2024 MABE27-017/2023 F9,40%
185ABE27-042/2024 MABE27-023/2023 F3,50%
186ABE27-042/2024 MABE27-026/2022 F8,10%
187ABE27-042/2024 MNIM96-010/2021 F1,50%
188ABE27-042/2024 MABE27-012/2024 F5,50%
189ABE27-042/2024 MABE27-014/2024 F11,90%
190ABE27-042/2024 MABE27-019/2024 F3,50%
191ABE27-042/2024 MABE27-023/2024 F3,50%
192ABE27-042/2024 MABE27-035/2024 F12,80%
193ABE27-042/2024 MABE27-036/2024 F12,80%
194ABE27-042/2024 MABE27-046/2024 F7,50%
195ABE27-042/2024 MABE27-047/2024 F7,50%
196ABE27-042/2024 MABE27-060/2024 F16,10%
197ABE27-042/2024 MABE27-078/23-2024 F6,80%
198ABE27-042/2024 MABE27-079/23-2024 F11,50%
199ABE27-042/2024 MNIM96-006/2024 F9,80%
200ABE27-042/2024 MNIM96-066/2024 F9,80%
201ABE27-043/2024 MABE27-037/2022 F17,40%
202ABE27-043/2024 MABE27-038/2022 F17,40%
203ABE27-043/2024 MABE27-017/2023 F9,40%
204ABE27-043/2024 MABE27-023/2023 F3,50%
205ABE27-043/2024 MABE27-026/2022 F8,10%
206ABE27-043/2024 MNIM96-010/2021 F1,50%
207ABE27-043/2024 MABE27-012/2024 F5,50%
208ABE27-043/2024 MABE27-014/2024 F11,90%
209ABE27-043/2024 MABE27-019/2024 F3,50%
210ABE27-043/2024 MABE27-023/2024 F3,50%
211ABE27-043/2024 MABE27-035/2024 F12,80%
212ABE27-043/2024 MABE27-036/2024 F12,80%
213ABE27-043/2024 MABE27-046/2024 F7,50%
214ABE27-043/2024 MABE27-047/2024 F7,50%
215ABE27-043/2024 MABE27-060/2024 F16,10%
216ABE27-043/2024 MABE27-078/23-2024 F6,80%
217ABE27-043/2024 MABE27-079/23-2024 F11,50%
218ABE27-043/2024 MNIM96-006/2024 F9,80%
219ABE27-043/2024 MNIM96-066/2024 F9,80%
220ABE27-033/2024 MABE27-037/2022 F17,40%
221ABE27-033/2024 MABE27-038/2022 F17,40%
222ABE27-033/2024 MABE27-017/2023 F9,60%
223ABE27-033/2024 MABE27-023/2023 F4,70%
224ABE27-033/2024 MNIM96-010/2021 F1,90%
225ABE27-033/2024 MABE27-012/2024 F7,30%
226ABE27-033/2024 MABE27-014/2024 F19,50%
227ABE27-033/2024 MABE27-019/2024 F4,70%
228ABE27-033/2024 MABE27-023/2024 F4,70%
229ABE27-033/2024 MABE27-044/2024 F12,80%
230ABE27-033/2024 MABE27-046/2024 F8,60%
231ABE27-033/2024 MABE27-047/2024 F8,60%
232ABE27-033/2024 MABE27-060/2024 F6,40%
233ABE27-033/2024 MABE27-078/23-2024 F17,90%
234ABE27-033/2024 MABE27-079/23-2024 F10,50%
235ABE27-033/2024 MNIM96-006/2024 F5,60%
236ABE27-033/2024 MNIM96-066/2024 F5,60%
237ABE27-055/2024 MABE27-037/2022 F2,10%
238ABE27-055/2024 MABE27-038/2022 F2,10%
239ABE27-055/2024 MABE27-017/2023 F8,40%
240ABE27-055/2024 MABE27-023/2023 F8,30%
241ABE27-055/2024 MABE27-026/2022 F3,30%
242ABE27-055/2024 MNIM96-010/2021 F14,60%
243ABE27-055/2024 MABE27-012/2024 F8,30%
244ABE27-055/2024 MABE27-014/2024 F4,80%
245ABE27-055/2024 MABE27-019/2024 F8,30%
246ABE27-055/2024 MABE27-023/2024 F8,30%
247ABE27-055/2024 MABE27-035/2024 F2,70%
248ABE27-055/2024 MABE27-036/2024 F2,70%
249ABE27-055/2024 MABE27-044/2024 F3,50%
250ABE27-055/2024 MABE27-046/2024 F5,20%
251ABE27-055/2024 MABE27-047/2024 F5,20%
252ABE27-055/2024 MABE27-060/2024 F6,60%
253ABE27-055/2024 MABE27-078/23-2024 F2,60%
254ABE27-055/2024 MABE27-079/23-2024 F14,40%
255ABE27-055/2024 MNIM96-006/2024 F9,90%
256ABE27-055/2024 MNIM96-066/2024 F9,90%
257ABE27-006/2024 MABE27-037/2022 F15,60%
258ABE27-006/2024 MABE27-038/2022 F10,00%
259ABE27-006/2024 MABE27-017/2023 F18,30%
260ABE27-006/2024 MABE27-023/2023 F18,20%
261ABE27-006/2024 MABE27-026/2022 F4,30%
262ABE27-006/2024 MNIM96-010/2021 F21,00%
263ABE27-006/2024 MABE27-012/2024 F8,80%
264ABE27-006/2024 MABE27-014/2024 F11,90%
265ABE27-006/2024 MABE27-019/2024 F18,20%
266ABE27-006/2024 MABE27-023/2024 F18,20%
267ABE27-006/2024 MABE27-035/2024 F7,10%
268ABE27-006/2024 MABE27-036/2024 F7,10%
269ABE27-006/2024 MABE27-044/2024 F6,40%
270ABE27-006/2024 MABE27-046/2024 F16,80%
271ABE27-006/2024 MABE27-047/2024 F16,80%
272ABE27-006/2024 MABE27-060/2024 F10,50%
273ABE27-006/2024 MABE27-078/23-2024 F9,80%
274ABE27-006/2024 MABE27-079/23-2024 F8,70%
275ABE27-006/2024 MNIM96-006/2024 F8,90%
276ABE27-006/2024 MNIM96-066/2024 F8,90%
277ABE27-057/2024 MABE27-037/2022 F5,00%
278ABE27-057/2024 MABE27-038/2022 F5,00%
279ABE27-057/2024 MABE27-017/2023 F9,80%
280ABE27-057/2024 MABE27-026/2022 F4,40%
281ABE27-057/2024 MABE27-012/2024 F10,60%
282ABE27-057/2024 MABE27-014/2024 F11,00%
283ABE27-057/2024 MABE27-035/2024 F4,70%
284ABE27-057/2024 MABE27-036/2024 F4,70%
285ABE27-057/2024 MABE27-044/2024 F3,50%
286ABE27-057/2024 MABE27-046/2024 F18,00%
287ABE27-057/2024 MABE27-047/2024 F18,00%
288ABE27-057/2024 MABE27-060/2024 F14,30%
289ABE27-057/2024 MABE27-078/23-2024 F15,40%
290ABE27-057/2024 MABE27-079/23-2024 F3,50%
291ABE27-057/2024 MNIM96-006/2024 F8,00%
292ABE27-057/2024 MNIM96-066/2024 F8,00%
293ABE27-009/2024 MABE27-037/2022 F4,80%
294ABE27-009/2024 MABE27-038/2022 F4,80%
295ABE27-009/2024 MABE27-017/2023 F6,50%
296ABE27-009/2024 MABE27-023/2023 F15,40%
297ABE27-009/2024 MABE27-026/2022 F3,90%
298ABE27-009/2024 MNIM96-010/2021 F14,60%
299ABE27-009/2024 MABE27-012/2024 F18,10%
300ABE27-009/2024 MABE27-014/2024 F7,00%
301ABE27-009/2024 MABE27-019/2024 F15,40%
302ABE27-009/2024 MABE27-023/2024 F15,40%
303ABE27-009/2024 MABE27-035/2024 F4,30%
304ABE27-009/2024 MABE27-036/2024 F4,30%
305ABE27-009/2024 MABE27-044/2024 F4,00%
306ABE27-009/2024 MABE27-046/2024 F11,40%
307ABE27-009/2024 MABE27-047/2024 F11,40%
308ABE27-009/2024 MABE27-060/2024 F9,30%
309ABE27-009/2024 MABE27-078/23-2024 F10,10%
310ABE27-009/2024 MABE27-079/23-2024 F7,00%
311ABE27-009/2024 MNIM96-006/2024 F5,90%
312ABE27-009/2024 MNIM96-066/2024 F5,90%
313ABE27-010/2024 MABE27-037/2022 F4,80%
314ABE27-010/2024 MABE27-038/2022 F4,80%
315ABE27-010/2024 MABE27-017/2023 F6,50%
316ABE27-010/2024 MABE27-023/2023 F15,40%
317ABE27-010/2024 MABE27-026/2022 F3,90%
318ABE27-010/2024 MNIM96-010/2021 F14,60%
319ABE27-010/2024 MABE27-012/2024 F18,10%
320ABE27-010/2024 MABE27-014/2024 F7,00%
321ABE27-010/2024 MABE27-019/2024 F15,40%
322ABE27-010/2024 MABE27-023/2024 F15,40%
323ABE27-010/2024 MABE27-035/2024 F4,30%
324ABE27-010/2024 MABE27-036/2024 F4,30%
325ABE27-010/2024 MABE27-044/2024 F4,00%
326ABE27-010/2024 MABE27-046/2024 F11,40%
327ABE27-010/2024 MABE27-047/2024 F11,40%
328ABE27-010/2024 MABE27-060/2024 F9,30%
329ABE27-010/2024 MABE27-078/23-2024 F10,10%
330ABE27-010/2024 MABE27-079/23-2024 F7,00%
331ABE27-010/2024 MNIM96-006/2024 F5,90%
332ABE27-010/2024 MNIM96-066/2024 F5,90%
333NIM96-100/2024 MABE27-037/2022 F0,00%
334NIM96-100/2024 MABE27-038/2022 F0,00%
335NIM96-100/2024 MABE27-017/2023 F0,00%
336NIM96-100/2024 MABE27-023/2023 F0,00%
337NIM96-100/2024 MABE27-026/2022 F0,00%
338NIM96-100/2024 MNIM96-010/2021 F0,00%
339NIM96-100/2024 MABE27-012/2024 F0,00%
340NIM96-100/2024 MABE27-014/2024 F0,00%
341NIM96-100/2024 MABE27-019/2024 F0,00%
342NIM96-100/2024 MABE27-023/2024 F0,00%
343NIM96-100/2024 MABE27-035/2024 F0,00%
344NIM96-100/2024 MABE27-036/2024 F0,00%
345NIM96-100/2024 MABE27-044/2024 F0,00%
346NIM96-100/2024 MABE27-046/2024 F0,00%
347NIM96-100/2024 MABE27-047/2024 F0,00%
348NIM96-100/2024 MABE27-060/2024 F0,00%
349NIM96-100/2024 MABE27-078/23-2024 F0,00%
350NIM96-100/2024 MABE27-079/23-2024 F0,00%
351NIM96-100/2024 MNIM96-006/2024 F0,00%
352NIM96-100/2024 MNIM96-066/2024 F0,00%
353NIM96-008/2021 MABE27-037/2022 F2,00%
354NIM96-008/2021 MABE27-038/2022 F2,00%
355NIM96-008/2021 MABE27-023/2023 F14,50%
356NIM96-008/2021 MABE27-026/2022 F1,70%
357NIM96-008/2021 MABE27-012/2024 F8,20%
358NIM96-008/2021 MABE27-014/2024 F8,10%
359NIM96-008/2021 MABE27-019/2024 F14,50%
360NIM96-008/2021 MABE27-023/2024 F14,50%
361NIM96-008/2021 MABE27-035/2024 F1,90%
362NIM96-008/2021 MABE27-036/2024 F1,90%
363NIM96-008/2021 MABE27-044/2024 F1,50%
364NIM96-008/2021 MABE27-046/2024 F14,30%
365NIM96-008/2021 MABE27-047/2024 F14,30%
366NIM96-008/2021 MABE27-060/2024 F7,70%
367NIM96-008/2021 MABE27-078/23-2024 F1,30%
368NIM96-008/2021 MABE27-079/23-2024 F1,50%
369NIM96-008/2021 MNIM96-006/2024 F14,50%
370NIM96-008/2021 MNIM96-066/2024 F14,50%
371ABE27-008/2024 MABE27-037/2022 F4,80%
372ABE27-008/2024 MABE27-038/2022 F4,80%
373ABE27-008/2024 MABE27-017/2023 F6,50%
374ABE27-008/2024 MABE27-023/2023 F15,40%
375ABE27-008/2024 MABE27-026/2022 F3,90%
376ABE27-008/2024 MNIM96-010/2021 F14,60%
377ABE27-008/2024 MABE27-012/2024 F18,10%
378ABE27-008/2024 MABE27-014/2024 F7,00%
379ABE27-008/2024 MABE27-019/2024 F15,40%
380ABE27-008/2024 MABE27-023/2024 F15,40%
381ABE27-008/2024 MABE27-035/2024 F4,30%
382ABE27-008/2024 MABE27-036/2024 F4,30%
383ABE27-008/2024 MABE27-044/2024 F4,00%
384ABE27-008/2024 MABE27-046/2024 F11,40%
385ABE27-008/2024 MABE27-047/2024 F11,40%
386ABE27-008/2024 MABE27-060/2024 F9,30%
387ABE27-008/2024 MABE27-078/23-2024 F10,10%
388ABE27-008/2024 MABE27-079/23-2024 F7,00%
389ABE27-008/2024 MNIM96-006/2024 F5,90%
390ABE27-008/2024 MNIM96-066/2024 F5,90%
Couples
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
It's a pitty you don't want/cannot use PQ solution, because it would be just 2 steps. unpivot and filter. In VBA it is a bit longer.
You shall probably also add clearing contents of output range and preformat that range before running code - or leave the format which is already there: (especially column widths and desired percentage format).

VBA Code:
Sub unpivot_with_condition()
Dim lrow As Long, lcol As Long, i As Long, j As Long, counter As Long
Dim rhdrs As Variant, chdrs As Variant, inarr As Variant, outarr() As Variant

With ActiveSheet
  lrow = .Range("L3").End(xlDown).Row
  lcol = .Range("M2").End(xlToRight).Column
  rhdrs = .Range(.Cells(3, "L"), .Cells(lrow, "L"))
  chdrs = .Range(.Cells(2, "M"), .Cells(2, lcol))
  inarr = .Range(.Cells(3, "M"), .Cells(lrow, lcol))
  ReDim outarr(1 To UBound(rhdrs) * UBound(chdrs, 2), 1 To 3)
  For i = 1 To UBound(rhdrs)
    For j = 1 To UBound(chdrs, 2)
      If inarr(i, j) <= 0.25 Then 'check if it needs to be < or <= 0.25
        counter = counter + 1
        outarr(counter, 1) = rhdrs(i, 1)
        outarr(counter, 2) = chdrs(1, j)
        outarr(counter, 3) = inarr(i, j)
      End If
  Next j, i
  .Range("AH3").Resize(counter, 3) = outarr
End With
End Sub
 
Upvote 0
Solution
Hello Kaper,
Thank you for your feedback and the proposed code, the latter works well and gives me the desired result.
In your message, you tell me that it is a shame not to use a PQ solution. If I asked this, it is for two reasons:
1. I do not know and I have never worked with the PQ.
2. The Range ("L1:AF23") on which we are working is a pivot table, do you think we can use a solution with PQ, with data collected from a pivot table, in the same way if the source data comes from a Normal Range like Range ("L1:AF23"). If it is possible, I am ready to try this solution with PQ.
Do not forget that I am a novice in vba mainly in PQ, I would need some explanations to put the solution with PQ in place.
A big THANK YOU and I await your return.
Greetings.
 
Upvote 0

Forum statistics

Threads
1,225,218
Messages
6,183,649
Members
453,177
Latest member
GregL65

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