Home > Software engineering >  How to VBA to realize the screening for help
How to VBA to realize the screening for help

Time:09-28

Assuming that A and B column data, as follows:
The number of urban
123 TKO
456 LAS
123 LAS
123 LAS
789 MAC
456 LAS
WWE 123
456 LAS
789 MAC

Assuming that when A column number repeat, if B bar code is not the only city, will all related in column C mark yes, as follows:
The number of urban
123 TKO yes
456 LAS
123 LAS yes
123 LAS yes
789 MAC
456 LAS
123 WWE yes
456 LAS
789 MAC

CodePudding user response:

Directly using the formulas:
In C1 cell input the following formula:

=the IF (COUNTIF ($A $1: $A $10, A1) & gt; 1, "yes", "")

And then directly down

CodePudding user response:

Start recording macros in Excel 2003, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,

CodePudding user response:

How do you do on the ground floor, I adopted the approach of you, it is concluded that the result is such, what reason be excuse me?
123 TKO yes
456 LAS yes
123 LAS yes
123 LAS yes
789 MAC yes
456 LAS yes
WWE 123
456 LAS yes
789 MAC yes

CodePudding user response:

reference lm_18515826375 reply: 3/f
how do you do on the ground floor, I used your method, the results is such, what reason be excuse me?
123 TKO yes
456 LAS yes
123 LAS yes
123 LAS yes
789 MAC yes
456 LAS yes
WWE 123
456 LAS yes
789 MAC yes

With the "formula", impossible to do so "smart", difficult to achieve more complex logic,
Your number 456 appeared many times, but the city code is the same, according to you mean, is not likely to be the "repeat",
This effect may only use VBA code for processing,

CodePudding user response:

At the same time according to the first A, B two column sorting,
To C2 unit input formula =the IF (OR (AND (A2=A1, B2=B1) AND (A2=A3, B2=B3)), "yes", "") , what,
  •  Tags:  
  • VBA
  • Related