Extracting Values from 300 sheets where vlookup doesn't work - multiple-databases

I have an excel spreadsheet which has just under 300 sheets in it. The first sheet has a list of items which are all numbered 1.1.1, 1.1.2 etc. The rest of the sheets have some of the items listed on them and not in numerical order. I am trying to extract the quantity and total listed against these items on all the different sheets.
The sheets are complicated by the fact that they are not well structure so have section titles which are across merged cells.
I could get this information by hand using the search facility in excel and visit each instance of the number and then add up all the quantities and totals by hand. Is there any way I can automate this? i.e. by asking excel to take each unique identifier from sheet 1, find it in the rest of the sheets and return the quantity and/or total?
I tried using vlookup but it only seemed to return one of the values and ignore all the others.
Even if there was a formula that I had to change the unique identifier by hand that would be much quicker!
Thank you for any help you can give. I am not a programmer so constructing the vb by myself would probably take longer than doing it by hand!

If you add a $ before your lookup data for example
search - $A&2:&AZ&1000
then you are telling excel to look for anything in that array.
because if you do not have a $ in and you copy it, it starts excluding everything above that.

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.

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.

Imported range time values dont match source range time values Google sheets script

I have simple google spreadsheet with two sheets: sheet1 and sheet2. In sheet2 there are time values in column A which I am trying to copy to column A in sheet2. I wrote a script(please see link) for it but values are not the same. What class/method do I need to use in order to get same values in both sheets.
I noticed if I format column A values in sheet2 to text than I get matching values but problem is I am not allowed to that and that column must remain formatted as time.
Also, my second question(please ignore if its off topic). If I have work schedule in google sheet for 3 employees: John,Peter and Mike and they all have editing permissions. If Mike decides to use filter to filter out just his work schedule, is it possible for other two employees to have unedited sheet(as I believe Mike's actions will affect other two persons). What I mean is, is it possible to restrict one persons actions just to view he is looking at while other have unaffected version(together work schedule in this case)?
link for spreadsheet:
https://docs.google.com/spreadsheets/d/1tOtwzM0CxDHBXzC8ECeXlfaTGC4i7rH2XMYYszqRINM/edit?usp=sharing
Much appreciated.
not entirely sure what the problem is, your script is working as intended and you have the same values in sheet1 as in sheet2. The only difference is that in Sheet1 you have a date format and on sheet2 you only indicate the time. I have changed the number format in the sheet1 and as you can see it's the same.
The problem you are having is that by indicating only the time, you let the sheet assume any date. For time it's not that big a deal, but you must be sure that time formats are the same. use getNumberFormat() and setNumberFormat() (read here) to set the correct formats when copying or have the formatting set in advance
As for filtering — you can simply give them view-only access and let them use filtere views (right under "Filter"). A filter will hide information for everyone on the sheet, while a filter view will only be visible to that person. You can also pre-set filter views for them as those with edit access can save filter views.

How do I efficiently output to a non-contiguous range in Google Apps Script (GAS)

I'm new to Google Script, so appreciate your help!
Here's what my data looks like (3 non-contiguous records, 4 non-contiguous fields):
https://docs.google.com/spreadsheets/d/18FFB2HlcfcciHj7NPmihZbuf47op2UMdRTKfpyTqowU/edit#gid=0
I have an array of the items and each item is an object that contains 4 keys. I want to output to Google Sheets in as few SetValue requests as possible. If I can't do it in 1 call, then it makes most logical sense to output each item at a time.
My idea is that I can create ranges for fields 1 and 4 that span the entire column. Then I can create ranges that span the entire Item row. Then the INTERSECTION between the 2 is the range I want to output to, once I have assembled an array of 2 values.
Or perhaps since assuming I know the rows/columns of each cell below, I can return the range and the use a UNION of the ranges to create the mapping instead.
But is there a function to do Intersection or Union in GAS? Or am I better off just outputting each cell 1 by 1?
Thanks for your help!
There's no such function. It's either one by one or contiguous cells.
But there's quite a few tricks/alternatives that might work for you. As Sandy pointed in a comment, you could get a contiguous range that had all required cells and set the non-required ones to blank or their original values. This has the down side of not working for formulas.
You could also pre-configured the required cells with simple formulas "pointing" to a continuous range. That would simply bulk update at once.
If bulk setting is really required, you could also grab all values and formulas of the wide range, and convert all plain values to their equivalent formulas, e.g. abc becomes ="abc" and 1/1/2015 =DATE(2015,1,1) (yes, it's cumbersome) and then use setFormulas to set everything back, both original formulas and values converted to formulas. Making no actual content change in the cells you don't want to and changing the required ones, all in one bulk operation.
Anyway, these are just workarounds. As stated in the first sentence, it's not possible, period. You probably want to star this report in Apps Script issue tracker to kind of vote for this feature and receive updates.