Help for Data Analyses

Newbie73

Board Regular
Joined
Feb 4, 2024
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm a bit of a newbie when it comes to Excel. In this last month I've tried to work on some data for a study that we're doing at my work.

The data is related to tests that certain individuals are required to do each x amount of times. First colum is the individual ID and Third colum the date of the tests.

14/11/2023 is the latest test, which the individual 3623, 3625 and 3626 have, meaning that all their data is still relevant.

3624 however doesn't have the last test, so I would like to flag it automatically with a formula and ideally in a different colum, so that then I could sort all the individuals without the lastest test to the bottom of the spreadsheet keep the "active" individuals and all their test results (including previous tests) on the top.

After days of failling to have an automatic formula to do this (even with helper colums), here I am. My Data has more colums but irrelevant to the example. It's over 10k rows with individuals having a varying number of tests, but my main thing is to sort the active ones from inactives (everything that doesn't have a test on 14/11/2023 is consider inactive). I've done this manual in another spreadsheet by having another colum and filling with a colour all the entries of all the individuals no longer active, and then sorting by no fill colour first.

Link to this example of spreadsheet:


Thank you so much in advance! Do let me know if you need any more detail or information, or if I wasn't clear enough.

3623CLEAR14/11/2023SEVERETRUE
3623CLEAR11/07/2023SEVERETRUE
3623CLEAR21/03/2023SEVERETRUE
3623CLEAR06/12/2022SEVERETRUE
3624CLEAR06/12/2022SEVEREFALSE
3625CLEAR14/11/2023SEVERETRUE
3625CLEAR11/07/2023SEVERETRUE
3625CLEAR21/03/2023SEVERETRUE
3625CLEAR06/12/2022SEVERETRUE
3626CLEAR14/11/2023SEVEREFALSE
3626CLEAR11/07/2023SEVEREFALSE
3626CLEAR21/03/2023SEVEREFALSE
3626CLEAR06/12/2022SEVEREFALSE
 
Thanks once again! Doing the trick, one last thing, is there a way that I could easily find that "blank cell" between the upper_md and lower_notmd? say that I have 30k of entries, would there be a way to find it quickly rather than scroll until finding it?

If you do come with a solution (as you somehow always do!) and it's based on a formula, could you had it to this one as well?

=LET(src,Data!A2:N30000, fsrc,FILTER(src,INDEX(src,,1)<>""), shortID,INDEX(fsrc,,1), dates,INDEX(fsrc,,13), maxdate,MAX(dates),
uidmd,SORT(UNIQUE(FILTER(shortID,dates=maxdate))), uidnmd,SORT(UNIQUE(VSTACK(shortID,uidmd),,1)),
utd,FILTER(fsrc,ISNUMBER(MATCH(shortID,uidmd,0))), nutd,FILTER(fsrc,NOT(ISNUMBER(MATCH(shortID,uidmd,0)))),
VSTACK(SORT(utd,{1,13},{1,-1}),EXPAND("",,COLUMNS(fsrc),""),VSTACK(SORT(nutd,{1,13},{1,-1}))))

No worries if not and than kyou for everything KRice!
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
You can easily find the blank row between sections. One way is to search for it using the MATCH function mentioned in my last post:
Excel Formula:
MATCH(TRUE,TAKE(Sheet5!R3#,,1)="",0)
where the results from the formula spill from Sheet5!R3# (adjust that reference to your worksheet). This "takes" the first column of the results and looks for the first instance of a blank. The MATCH function will return the index of that blank. By "index", I mean the function begins counting the first row of the results as 1, even though, in this case, the formula begins producing results at row 3. If you'd prefer the row number rather than the index, then:
Excel Formula:
=ROW(Sheet5!R3)+MATCH(TRUE,TAKE(Sheet5!R3#,,1)="",0)-1
so that we return the actual worksheet row number of the blank.

Or, if you want this delivered as part of your results table (I've placed it in the first row), you could do something like this, but you'll need to ensure that the width of the columns displaying the text are wide enough:
Excel Formula:
=LET(src,Data!A2:N30000, fsrc,FILTER(src,INDEX(src,,1)<>""), shortID,INDEX(fsrc,,1), dates,INDEX(fsrc,,13), maxdate,MAX(dates),
uidmd,SORT(UNIQUE(FILTER(shortID,dates=maxdate))), uidnmd,IFERROR(SORT(UNIQUE(VSTACK(shortID,uidmd),,1)),""),
utd,FILTER(fsrc,ISNUMBER(MATCH(shortID,uidmd,0))), nutd,IFERROR(UNIQUE(VSTACK(fsrc,utd),,1),EXPAND("",,COLUMNS(fsrc),"")),
upperhd, HSTACK("Max Date Block",EXPAND("",,COLUMNS(fsrc)-3,""),"lower block at row " & ROW()+ROWS(utd)+1,EXPAND("",,1,"")),
VSTACK(upperhd,SORT(utd,{1,13},{1,-1}),EXPAND("",,COLUMNS(fsrc),""),VSTACK(SORT(nutd,{1,13},{1,-1}))))
Also note that I've revised the definitions of uidnmd and nutd in this formula to wrap the original expressions with an IFERROR function, and then to return either a single "" or an array of ""'s for the scenario where there are no User ID's that are NOT associated with a maxdate. Without these revisions, the original formula will produce an error.
The end result looks like this:
MrExcel_20240203.xlsx
BCDEFGHIJKLMNO
3Max Date Blocklower block at row 19
43623KK362300000003623CLEAR014/11/2023SEVERE
53623YY362300000003623CLEAR006/10/2023SEVERE
63623HH362300000003623CLEAR011/07/2023SEVERE
73623U362300000003623CLEAR021/03/2023SEVERE
83623CCC362300000003623CLEAR006/12/2022SEVERE
93624EE362400000003624CLEAR014/11/2023SEVERE
103625WWW362500000003625CLEAR014/11/2023SEVERE
113625OOO362500000003625CLEAR011/07/2023SEVERE
123625GG362500000003625CLEAR021/03/2023SEVERE
133625GG362500000003625CLEAR006/12/2022SEVERE
143625EE362500000003625CLEAR006/12/2022SEVERE
153626PP362600000003626CLEAR014/11/2023SEVERE
163626BBB362600000003626CLEAR011/07/2023SEVERE
173626JJJ362600000003626CLEAR021/03/2023SEVERE
183626D362600000003626CLEAR006/12/2022SEVERE
19
203628II362800000003628CLEAR006/12/2022SEVERE
Sheet6
Cell Formulas
RangeFormula
B3:O20B3=LET(src,Data!A2:N30000, fsrc,FILTER(src,INDEX(src,,1)<>""), shortID,INDEX(fsrc,,1), dates,INDEX(fsrc,,13), maxdate,MAX(dates), uidmd,SORT(UNIQUE(FILTER(shortID,dates=maxdate))), uidnmd,IFERROR(SORT(UNIQUE(VSTACK(shortID,uidmd),,1)),""), utd,FILTER(fsrc,ISNUMBER(MATCH(shortID,uidmd,0))), nutd,IFERROR(UNIQUE(VSTACK(fsrc,utd),,1),EXPAND("",,COLUMNS(fsrc),"")), upperhd, HSTACK("Max Date Block",EXPAND("",,COLUMNS(fsrc)-3,""),"lower block at row " & ROW()+ROWS(utd)+1,EXPAND("",,1,"")), VSTACK(upperhd,SORT(utd,{1,13},{1,-1}),EXPAND("",,COLUMNS(fsrc),""),VSTACK(SORT(nutd,{1,13},{1,-1}))))
Dynamic array formulas.
 
Upvote 0
Thank you!! I went down the row option and created a link to it, so that I can get to the blank cell straightaway. Really appreciate it!
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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