Dec 16 2021 05:16 AM - edited Dec 16 2021 09:35 AM
I am looking for a formula or a short code for
comparing column 5 (Unique) values with column 4 in Sheet 1 of Workbook and if they are equal that row should be copied to Sheet 2 which will be my output sheet.
Column 5 Will have a unique value
Column 4 might have duplicates
the below is an example data set - the values will be of 6 or 8 digit random numbers for column 5 and 4
Dec 16 2021 06:06 AM
=FILTER(A1:D17;(D1:D17=45)+(D1:D17=46)+(D1:D17=47)+(D1:D17=48)+(D1:D17=10))
With Office365 or 2021 you can apply Filter function. With other versions of excel you can use advanced filter.
Dec 16 2021 06:56 AM - edited Dec 16 2021 07:02 AM
Thanks for the help , but actually my column 5 will have 100-200 unique values which needs to check against 49000 values in Column 4- is it possible to have range of the column in place of number 45 , 46 , 47, 48?
Dec 16 2021 07:16 AM - edited Dec 16 2021 07:21 AM
@karth1109 I would opt for Power Query. Connect to the file with 49000 entries. Likewise, connect the list of 100-200 values you want to extract. Then merge the the two.
Are you familiar with PQ? If not, the link below would be a good place to start.
Dec 16 2021 08:15 AM
=OR(AND(D2>=1,D2<=100),D2=200,D2=300,D2=400)
With above formula you can enter ranges of numbers or any individual numbers as in (filter criteria) range G1:G2 in attached sheet. I did advanced filter for 5000 rows in columns A to D and it works in my spreadsheet. To verify the filter result i applied SUMPRODUCT formula for columns A to C. The sumproduct formulas are in cells O1:Q1.
Dec 16 2021 08:46 AM
=FILTER(A2:D17;((D2:D17>=45)*(D2:D17<=48))+(D2:D17=10))
With Office365 or 2021 it is above formula i should say in addition.
Dec 16 2021 09:28 AM
Dec 16 2021 10:45 AM
If one can solve this with VBA or Power Query that would probably be the best way.
I can't do this with either way but i can suggest a makeshift solution.
In attached file in sheet "Tabelle2" i entered values in Column Z (this can easily be done with autofill) and used a formula to concatenate these values in Column AA. I copied the entry of cell AA200 and pasted only values in cell G4 and wraped it in an OR formula in cell G4. Now range G3:G4 is the criteria range for advanced filter. I verified the filter result with a nested sum formula in cells O4 and P4.