Mark Mahoney
New Member
Members
Forum Posts: 1
Member Since:
April 30, 2021
April 30, 2021
Offline
I have data that I want to ensure that specific ranges of rows remain in the dataset.
In the example below. I want to keep 4 rows below item c in col1. For every entry of 'c'.
Col 3 shows for example purposes the rows that I want to remain.
I cannot for the life of me find a way of doing it.
Col 1 | Col 2 | Col 3 |
a | 1 | |
b | 2 | |
c | 3 | x |
x | 4 | x |
y | 5 | x |
fff | 6 | x |
g | 7 | |
h | 8 | |
i | 9 | |
j | 10 | |
k | 11 | |
l | 12 | |
c | 13 | x |
d | 14 | x |
e | 15 | x |
f | 16 | x |
g | 17 | |
r | 18 | |
s | 19 | |
c | 20 | x |
cd | 21 | x |
er | 22 | x |
ff | 23 | x |
Mynda Treacy
Admin
Forum Posts: 4784
Member Since:
July 16, 2010
July 16, 2010
Offline
Hi Mark,
Welcome to our forum!
You can use this formula in a new column to extract the values from column 1:
= try if [Col 1] = "c" then [Col 1] else if #"Changed Type"{[Col 2]-2} [Col 1] = "c" then #"Changed Type"{[Col 2]-1} [#"Col 1"] else if #"Changed Type"{[Col 2]-3} [Col 1] = "c" then #"Changed Type"{[Col 2]-1} [#"Col 1"] else if #"Changed Type"{[Col 2]-4} [Col 1] = "c" then #"Changed Type"{[Col 2]-1} [#"Col 1"] else null otherwise null
Then filter out the null rows. See file attached.
Mynda
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Alan Sidman
Guest(s) 7
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1945
SunnyKow: 1432
Anders Sehlstedt: 959
Purfleet: 415
Hans Hallebeek: 377
Frans Visser: 351
David_Ng: 318
lea cohen: 248
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
Jennifer Hull
kris king
Hasanul Karim
Terrie s
Jack Ennis
Gary Day
Michael Wiliams
Jim Collier
Allan Chan
Rik Lelliott
Forum Stats:
Groups: 3
Forums: 25
Topics: 7159
Posts: 31414
Member Stats:
Guest Posters: 50
Members: 34674
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —