Create a Macro the deletes rows based on a certain criteria - google-apps-script

there can you help me write a macro that deletes all the rows that does not contain for example 'AUDJPY'
I made a Macro but it does not seem to be working. So I just want all rows that contain AUDJPY. If I do not need to use a macro and there is a easier way please assist
[I excluded the code as it is not accepted by stack overflow]
Get rows of information that are related or contain for example AUDJPY and delete all the other rows that does not contain "AUDJPY". I will like to do the same for other pairs such as EURCAD ect

Related

Can I create a List Generator based on specific Data Criteria

I have a workbook that contains a comprehensive list of Test Scenarios my developers are responsible for. In the workbook I would like to create a "generator" that will return a complete list of tests that need to be completed based on a specific criteria.
Criteria List. When a specific answer is selected on Sheet2 it correlates to a specific column on Sheet3, and I want to populate all rows associated with that answer AND remove duplicates onto Sheet1.
For example If B2 in Sheet2 is Yes, then I want to return all rows from Sheet3 where YES appears in Column D but if Sheet2!B2 is No, I want to return all rows where No appears in Sheet3!D.
I can successfully queue an individual line/criteria using ARRAYFORMULA(IF(TestCaseGenerator!B2="YES", IF(Disputes1!D:D="YES",Disputes1!A:M,""),""))
But I have tried several =ARRAYFORMULA, =IFS, =QUERY combinations and as I stack the criteria the formula breaks; I get one of two errors:
a parse erorr and as of yet cannot determine where exactly the formula is breaking down
Not enough arguments
I know a script may be a better option, but have not written many scripts and am unsure where to even start.

SSRS (MS Report Builder) - How do I add multiple lines of queried details to a single row of otherwise more general info?

I've been trying to figure this out, but I'm struggling.
Working in Microsoft Report Builder (latest version), I have a table that, for the most part, contains general information from a specific table, which I'll call GeneralInfo. In that table, each person has only a single row containing information about that person. However, one of my columns has a one-to-many relationship with the rest of the row. I'll call this other column DetailInfo.
This table provides an example of the kind of thing I'm going for:
In this example, all of the white cells come from the GeneralInfo table. The Orange cell may include many rows of work history, and each entry includes multiple elements from the DetailInfo table, separated by Newlines. The two tables can be matched / joined on the ID value.
This may not be the best way to go about a report, but it's part of the spec I was given. I know this can be done, but I'm having trouble learning how. Can anyone help me out?
Edit - I just found out that another column is also potentially one-to-many. In the example table, it would be saying that the "Occupation" value comes from the DetailInfo table, rather than the GeneralInfo table.
In MOST circumstances, this would just be "Construction Foreman" over and over again, and we would only want to show that once. However, in rare circumstances, an individual may have multiple concurrent (differing) Occupation values that would have to be shown. Is that possible? Should I make that a separate question?
I took Soundappan A's advice and created a sub-report in the column that needed the extra data. This video was helpful to me in learning how to set that up:
https://www.youtube.com/watch?v=LhSitVAnhyc

Auto Sorting Sheets Based on Values

I'm creating a rudimentary inventory tracking system. I first want anything with a value greater than zero to appear at the top of the sheet (current inventory), and then I want all of those rows to be "sub-sorted" alphabetically. I successfully auto-sorted my sheet by two separate columns using the script in this link:
https://www.idiotinside.com/2018/06/08/sort-multiple-columns-google-sheets-apps-script/
However, I want one of the columns to be sorted by a value (greater than zero). I've been searching the stacks and haven't found anything related. I searched the script library, as well, but new to this, so may not have searched properly.
Any help much appreciated!

google sheets query first row mess

I am designing a workflow at work to streamline some tasks. I get some CSV from a database which I want automatically added to a Google Sheet. I stored it on a Google Drive, got the direct download link and used it with IMPORTDATA on sheet1. So far so good.
The final aim is to create a good way to visualize which rows meet specific conditions, so I thought using a PivotTable might be handy. However, to filter out some of the uninteresting rows, PivotTables are not the way to go, since the filters are quite poor (no possibility of basic filter criteria like =, !=, <, >, etc). So I thought about populating a second sheet with a Query function (with the filtering statements) so that the PivotTable generates a report directly from a filtered source.
The issue (apart from the lag) is that sheet 2 (the one with the query) shows a strange output: the first row, that should contain only the column labels, mixes up the column labels with the value of the cell below them. It is quite baffling. Moreso because it does not happen all along row 1, but it only appears to do so on the first seven columns. So insted of A1 showing "event_id", it actually shows "event_id 106727", which is the value of the fisrt event that should go on A2.
Any thought why this happens?I already checked and there does not seem to be anything wrong with the CSV.
If yyou also have a suggestion of why this whole setup would be a bad idea, please also tell me :P
Thank you!
The query command combines multiple header rows into one. And sometimes it mistakes your data for headers. To avoid this, use the optional third parameter to specify the number of header rows:
=query(range, query_string, 1)
(if there is one header row).
The approach by #user6655984 did not work for me, because I was already using the third parameter to customise my header usage.
What occurred was that I was performing 12 queries to different sheets with similarly data. One column was a mixture of strings, such as "12 FPS", "14fps", and numbers. When I began working my way through these columns on all the sheets, I was left with mostly numbers, with a few strings spread throughout.
This caused my query to create a massive first row which concatenated the results of about 6 rows together, cell by cell, before showing the rest of the results, where in this column I edited, all the strings had been removed.
By happenstance I saw this one person here who talked about fixing a query issue by making sure that they type-converted the information in a column to be consistent.
This led me to find the following Google support forum post, about queries and data types, from 2019: Query function not working with specific data set (but working with others)
Giving this a go, I tried turning all the data in all the columns that were equivalent to each other in each sheet I was querying into numbers fixed the issue. Try this if setting headers is not working; make sure you don't have silent type errors.

Compare one column in excel to another column in excel and find duplicate values

I was just wondering if there was an easy way in Excel to complete the following task:
In my Excel spreadsheet I have two tabs. One tab represents one database and the other tab represents a different database. I have a column of data that is 1500+ rows long from my first database(tab) that looks like this:
In the other tab, I have another column that is similar to the above column. My goal is to be able to compare the above column to the other column in the separate tab, and search for duplicate values.
So for example the first code in the above column is 00064. It would search the specified column in the separate tab for the code 00064. If it finds it I would need to be alerted or have it logged somehow. Then it would move on to the next code, 00368 and repeat the process for every cell inside that column. I hope this makes sense. Please feel free to ask any questions you may have for further clarification.
My desired outcome is to ween out the duplicate values but I am not sure how to go about this because due to the length of my columns, manual comparisons would take quite some time. If there is a macro that could accomplish this it would make my life so much easier.
I greatly appreciate any help that can be offered.
Thank you!
-Dave
No need for VBA here. In the first cell of your second column (B1) of your first tab use a countif formula:
=countif(tab2!A:A, A1)
Copy this formula down so it is next to every populated cell in Column A. This will return the number of records in Tab2 that are equal to A1 in your first tab. Look for anything > 0 to find things that have a match, or things > 2 for duplicates.
You can extend this with an if statement like
=if(countif(tab2!A:A, A1)>2, "Duplicate", countif(tab2!A:A, A1)=1, "Only one Match", "No Match"))
This does not require the use of a macro. I would use a VLOOKUP formula. If an exact match is found between the columns it will return the columns value. If no match is found the cell will read #N/A.
An example of the formula that compares the cell A1 on Sheet1 to the column A on Sheet2 looks like this:
=VLOOKUP(A1,Sheet2!A:A,1,)
Here is documentation on how to use this formula.