Automatic organization

Pietro Di Micio

Board Regular
Joined
Apr 29, 2020
Messages
51
Office Version
  1. 365
Platform
  1. MacOS
Hi Folks,

I am wondering if its possible to create an automatic organization of some data based on a key code, image and details below.

Tks in advance.
 

Attachments

  • 2024-03-10_20-03-54.png
    2024-03-10_20-03-54.png
    44.1 KB · Views: 11
Thanks for the extra XL2BB data.
I am assuming that each day you paste the new data into cell B7, not further down column B. Post back with details if that is not the case.
I am also assuming that there is none of the green/yellow colour in columns B or E before this code is first activated.

Test with a copy of your workbook.

This is a Worksheet_Change event code and will be triggered when the data is pasted into B7. (It may also be triggered at other times but it shouldn't do anything on those occasions.
To implement the code
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test by pasting some data into the B7 area.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim lrB As Long, lrE As Long

  If Not Intersect(Target, Range("B7")) Is Nothing Then
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    lrB = Range("B" & Rows.Count).End(xlUp).Row
    lrE = Range("E" & Rows.Count).End(xlUp).Row
    Range("B7:E" & IIf(lrB > lrE, lrB, lrE)).FormatConditions.Delete
    Range("E7:F" & lrE).Insert Shift:=xlToRight
    With Range("E7:E" & lrE)
      .Formula2 = Replace("=FILTER(G$7:H$#,G$7:G$#=B7,INDEX(FILTER(G$7:H$#,ISNA(MATCH(G$7:G$#,B$7:B$#,0))*ISNA(MATCH(G$7:G$#,E$6:E6,0)),""""),1,0))", "#", lrE)
      .Resize(, 2).Value = .Resize(, 2).Value
      .Offset(, 2).Resize(, 2).Delete Shift:=xlToLeft
      .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(E7<>"""",B7=E7)"
      .FormatConditions(1).Interior.Color = 13693658
      .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(E7<>"""",B7<>E7)"
      .FormatConditions(2).Interior.Color = 65535
    End With
    With Range("B7:B" & lrB)
      .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(B7<>"""",B7=E7)"
      .FormatConditions(1).Interior.Color = 13693658
      .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(B7<>"""",B7<>E7)"
      .FormatConditions(2).Interior.Color = 65535
    End With
    Application.EnableEvents = True
    Application.ScreenUpdating = True
  End If
End Sub
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Thanks a lot, but allow me to share som details about the trouble that I am facing; looking to the sample below:

1) From column B to column O I updated every day doing a copy paste from others reports;
2) Column P to Z I keep some data that I want to keep the tracking (special the column R that I write steps/status);
3) Note that Column G and Column P are the KEY CODE, in other words the key to match the data;
4) What I want; due the fact that I have a lot of lines (=500), its ver complicated to match the informations, so when I copy & paste the data as I explained in the item 1 I need that the columns that I explained in the item 2 match the same line in a automatic way.

Thanks in advance.

pdm_cockpit.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZ
31
321/31/24
332/29/24
343/15/24
353/22/24
36A - PurchaseB - NegotiateC - Select--3/29/24
37FLSMIAEOPP. OWNERCOMPANYOPP. DESCRIPT.OPP. IDFCST CATEGORYOPP PHASECLOSE DATENET SAP USDLOBPARTNERPBMCQ LINEARITYOPP. ID2COMPANY2CADENCESQ/GAFWHY CHANGEWHY NOWWHY SAPDECISION MAKERPROPOSALCOLOR CODETABLE
38 M1 ok yyyyy|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100%100%
39 M1 - -----0%0%
40 M1 - -----0%0%
41 M1 - -----0%0%
42 M1 - -----0%0%
COCKPIT - CQ
Cell Formulas
RangeFormula
G36G36=SUBTOTAL(3,G38:G1055)
K36K36=SUBTOTAL(9,K38:K1055)
Y38:Y42Y38=REPT("|",(COUNTIF(Table1[@[WHY CHANGE]:[PROPOSAL]],"y")/5)*75)&(COUNTIF(Table1[@[WHY CHANGE]:[PROPOSAL]],"y")/5)*100&"%"
Z38:Z42Z38=COUNTIF(Table1[@[WHY CHANGE]:[PROPOSAL]],"y")/5
O38:O42O38=IF(A38<=$O$32,"M1",IF(A38<=$O$33,"M2",IF(A38<=$O$34,"SC",IF(A38<=$O$35,"LW",IF(A38>=$O$36,"QE","QE")))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
T38:X537Cell Value="-"textNO
T38:X537Cell Value="n"textNO
T38:X537Cell Value="y"textNO
S38:S537Cell Value= "-"textNO
S38:S537Cell Value="help needed"textNO
S38:S537Cell Value="pending"textNO
S38:S537Cell Value="ok"textNO
S40:S537Cellcontains an errortextNO
P38:P537Expression=IF(P38<>0;ISERROR(MATCH(P38;$G$30:$G$1000;0));0)textNO
O38:O537,R38:R537Cellcontains an errortextNO
H38:H537Expression=(OR(H38="Committed";H38="Probable";H38="Booked/Won"))textNO
K38:K537Cell Value>=$K$30textNO
K38:K537Cellcontains an errortextNO
Y38:Y537Expression=$Z38=0%textNO
Y38:Y537Expression=AND($Z38<=49%;$Z38>=1%)textNO
Y38:Y537Expression=AND($Z38>=50%;$Z38<80%)textNO
Y38:Y537Expression=AND($Z38>=80%;$Z38<=100%)textNO
G30,G38:G537Expression=IF(G30<>0;ISERROR(MATCH(G30;$P$30:$P$1000;0));0)textNO
L31:N35Cellcontains an errortextNO
I30,I38:I1055Expression=IF(AND(L30<>0;L30<>"T&E");ISERROR(MATCH(I30;$B$36:$E$36;0));0)textNO
J30,J38:J537Expression=IF(AND(J30<>0;L30<>0;L30<>"T&E";H30<>0;H30<>"Booked/Won");ISERROR(MATCH(J30;$K$35:$O$35;0));0)textNO
Cells with Data Validation
CellAllowCriteria
S38:S537List=$S$26:$S$29
T38:X537List=$T$27:$T$29
 
Upvote 0
Is it complex?
Yes, especially when the layout, data and explanation keep changing! :(

The way that I would attempt this (using a Windows OS) is not available on a Mac & I don't have a Mac to test alternatives so I'm not sure I can help.
 
Upvote 0

Forum statistics

Threads
1,215,636
Messages
6,125,952
Members
449,276
Latest member
surendra75

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