Help to tidy up information, standardise it & spot the clashes

ellison

Active Member
Joined
Aug 1, 2012
Messages
343
Office Version
  1. 365
Platform
  1. Windows
Hi, we are trying to tidy up some information where we have:
- Column A in the inputs
- Column B is the status which has been added, but needs tidying up
At the moment we use a combination of sorting information, vlookups and pot luck to try to come up with the tidied up version of the Status info, but we are wondering if there may be a better method?!
Hopefully this shows some detail about what we are trying to get at...
But if you have any questions, please just ask.

Please note we don't need the notes column automating, it's just there to help to show what we are trying to achieve in the Status-V2 column :)


RowInputStatus-OrigNotesStatus-V2
1AlphaAlpha: 2 blank entries and 1 x "pending", so "pending" woud be in Status V2:pending
2AlphapendingAlpha: 2 blank entries and 1 x "pending", so "pending" woud be in Status V2:pending
3AlphaAlpha: 2 blank entries and 1 x "pending", so "pending" woud be in Status V2:pending
4BetacompletedBeta: 0 blank entries and 1 x "completed", so "completed" would be in Status V2:completed
5CharliecompletedCharlie: 1 blank entries and 1 x "completed", so "completed" would be in Status V2:completed
6CharlieCharlie: 1 blank entries and 1 x "completed", so "completed" would be in Status V2:completed
7DeltacompletedDelta: 0 blank entries and 1 x "completed" AND 1 x "WIP", so "_clash" would be in Status V2:_clash
8DeltaWIPDelta: 0 blank entries and 1 x "completed" AND 1 x "WIP", so "_clash" would be in Status V2:_clash
9EchoWIPEcho: 0 blank entries and 1 x "WIP", so "WIP" would be in Status V2:WIP
10FoxtrotFoxtrot: 1 blank entries Status V2 would be blank:
 
On large data you could use a macro. Does not slow down your file

VBA Code:
Sub jec()
 Dim ar, dic, i As Long
 ar = Range("A2", Range("A" & Rows.Count).End(xlUp)).Resize(, 3)
 Set dic = CreateObject("scripting.dictionary")
 
 For i = 1 To UBound(ar)
   If ar(i, 3) <> "" Then
     If dic.exists(ar(i, 2)) Then
       dic(ar(i, 2)) = "_Clash"
     Else
      dic(ar(i, 2)) = ar(i, 3)
     End If
   End If
 Next
 For i = 1 To UBound(ar)
   ar(i, 3) = dic(ar(i, 2))
 Next

 Range("A2", Range("A" & Rows.Count).End(xlUp)).Resize(, 3) = ar
End Sub
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It starts with this

=ISNUMBER(SEARCH({"Pending","Completed","WIP"},D2:D11) --> gives array of true and falses

If you put this in the BYROW, it iterates from top to bottom.
Here some detail. The next step would be the substitute

Book1
GHIJK
1Starting pointByrow
2
3TRUEFALSEFALSEPending
4TRUEFALSEFALSEPending
5TRUEFALSEFALSEPending
6FALSETRUEFALSECompleted
7FALSETRUEFALSECompleted
8FALSETRUEFALSECompleted
9FALSETRUETRUECompletedWIP
10FALSETRUETRUECompletedWIP
11FALSEFALSETRUEWIP
12FALSEFALSEFALSE
Sheet2
Cell Formulas
RangeFormula
G3:I12G3=ISNUMBER(SEARCH({"Pending","Completed","WIP"},D2:D11))
K3:K12K3=BYROW(G3#,LAMBDA(a,TEXTJOIN(,,FILTER({"Pending","Completed","WIP"},a,""))))
Dynamic array formulas.

Thanks JEC for explaining

How "a" works in lamda, what is that?
 
Upvote 0
It is just a variable which you use to iterate through the byrow array
 
Upvote 0
On large data you could use a macro. Does not slow down your file
I don't know if its possible but if Alpha had 2 pending lines, the code in post #11 would return _Clash.

How about changing
VBA Code:
dic(ar(i, 2)) = "_Clash"

to
VBA Code:
If dic(ar(i, 2)) <> ar(i, 3) Then dic(ar(i, 2)) = "_Clash"
 
Upvote 0
Yes good point! So if this is possible, ellison could use your suggestion(y)
 
Upvote 0

Forum statistics

Threads
1,215,374
Messages
6,124,569
Members
449,173
Latest member
Kon123

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