PDA

View Full Version : VBA to Extract digit and text from two different columns of excel



ashmita
08-12-2021, 10:14 AM
Hello Sir,


I developed a VBA that will extract all Outlook email based on the subject line as 'Submitted' and store it in Col A and B of 'Out'sheet. My req is
1)To retrieve the digit available between square bracket from col A . E.g. '10234563' from R1

2)To extract text present between "Headline" and "Description" from COl B. E.g. '121 - Person has complained about the product' from R1


3)To pull digit from text beginning with 'TID' in first encounter. E.g. '21345' from R6




Once extraction is done, the value from req-1, req-2, req-2 need to be added into Col A, col B, Col H of Sheet "Datas" (before that clear content of sheet 'Datas' as old records might exist for earlier operation)


4)Delete entire record from Sheet "Datas" for duplicate only when [value in Col A is not null and for col B is null]

E.g.The value '11111' from R7 & R8 are duplicate. Row number 7 (R7) should be removed as it contain null value for col B

ashmita
08-14-2021, 11:52 PM
Can anyone help me for the solution of my query

arnelgp
08-15-2021, 03:07 AM
i made some function in module1.
see Out sheet.

sorry, my browser won't allow me to attached (it says unsecured).

https://www.dropbox.com/scl/fi/qahbm79r5iil0ejygkomv/Read.xlsm?dl=0&rlkey=bt7ha6kl7sqdn73cz4neyxdrq

ashmita
08-18-2021, 06:27 AM
Thank you so much arnelgp for your great help. As I don't have much knowledge on macro, can all this macro can be called with a single master macro without mentioning formula. The program should auto populate the activities. Thanks once again

arnelgp
08-18-2021, 10:01 PM
it is meant to be run as Function (just as ordinary excel function).

parttime_guy
09-03-2021, 12:27 AM
Hi
Simple Excel formula should do the trick
Formula 1 (J2) =COUNTIFS(A:A,A2)
Formula 2 (K2) =IF(AND(J2>1,B2=""),"DUPLICATE","")

Filter "DUPLICATES" and delete the ROWS

Sample file attached

If you need a automated process - kindly contact