Filtered view of the data in one Google spreadsheet affecting the integrity of the data in dependent Google spreadsheets? - spreadsheet

Good morning smart people,
I have spreadsheet "A" into which someone enters all the data, this sheet is edited, updated and maintained daily.
I then have spreadsheets "B" "C" and "D" that rely on spreadsheet "A" for all or part of their data ( using QUERY and importRange ).
If a 'filter' or 'sort' is temporarily applied to spreadsheet "A" by the person editing the sheet ALL of the dependent sheets receive the filtered data view too and thus breaks all of that sheets calculations and results !!
The filtering or sorting of the data appears to be on the data itself rather than just the "local view" and is therefore being "imported" into all dependent sheets .... is there a better way to do this to prevent "breaking dependent sheets ?
Is it possible to continue to import the "raw" unfiltered data into dependent sheets ?

I may have misunderstood what you are trying to do here, but I'm afraid I have some bad news.
For me (after doing some experiment), filtering (assuming that we are doing filter with the Data menu Filter option) does not affect the result of the other sheets. If this is not the case for you, can you please link a demo spreadsheet so we can see your actual problem?
On the other hand sorting does affect the other sheets, since it changes the order of the records (=rows) in the table. I don't know any workaround to tell the filter sheet not to respond to the sorting.

Related

Need script to automate process

We keep our orders & production in Excel. An order workbook looks something like this:
Main Order XXXX
Cabinet
Solid Surface
Diewall
Custom
Metal
Finishing
Moulding
Adaptable
On our Main Order tab, we have a table with all the items on the order. What I need, is a way to automate copying certain rows to certain sheets. We have column on the Main Order that can be used to state which sheet that row needs to go to. Also worth noting, we sometimes have to ADD new sheets if we need more items that need to go on 2 separate Custom tabs for example (but this could apply to any of the sheet names other than Main Order). We do that by copying the applicable sheet and renaming it 'Custom1', 'Custom2'. It's the same format for each sheet - a number after the name of the sheet, no space. Right now, we are doing this all manually and it's very time consuming. Would it be possible to make the script create the new sheet based on what is in the Main Order? Meaning, if we put 'Custom1' in the Main Order table, can the script create the sheet called 'Custom1', copying the 'Custom' sheet and then adding the rows from the Main Order?
I'm not sure if it matters, but the Main Order sheet table starts at Row 18 and is variable in length depending on the order. There's another table below that, but that doesn't need to be copied anywhere. The tables where that rows need to be copied on the other sheets all start at Row 13 (that's the header row) and we can add however many columns we need.
I will admit I'm very new to scripts and VBA, but I have a very basic understanding (I think anyway). I feel like what I'm looking for should be possible, I just don't know enough to figure it out on my own at this point.
I found a script that copies rows to a table, but I need it to be more dynamic. I don't want to have to create a script for each sheet, especially since new sheets can be created as stated above. Below is the script I already have, and I confirmed it worked for the 1 sheet ('Adaptable'). I'm hoping someone can help me make this more 'generic' if that makes sense? So in our Main Order, I want to be able to put in a column the sheet name that the row needs to be copied to and then have it automatically copied, or if the user needs to click 'Run Script' or whatever, that would still be much easier and faster than what we're currently doing.

Formatting Data in excel sheet with blue prism

I'm trying to run a duplicate check In which varying data is pulled from a website and compared to a master list, the master list being stored in Excel. The information from the website is read from a table in which has line breaks. These breaks are translated over to the data collection they are initially stored in. Some of the data from the website us eventually written to the master list in Excel. So when I read the master list back into Blue Prism to run a duplicate check, the rows that have line breaks are written into a collection as multiple rows (ex. I should have on 7 rows in my collections but am getting 42). Since the rows are not EXACTLY the same between the 2 collections, when it runs the automation does not recognize the duplicates.
The easiest way to solve this would be if I could make the collection rows have no line breaks as soon as the data is read. I've attempted to use the calculation stage to do so with no luck. I'm not sure if it is actually possible to do this, but would appreciate any direction.
Record an Excel macro to do the data sorting/cleaning in Excel (possibly Text To Columns, etc..) and then include the running of the macro as part of your Blue Prism process by using an action stage and the MS Excel VBO - Run Macro. Get the process to create an Excel instance (and create a handle data item from that stage), then use Open Workbook (whatever workbook you store your Macro in) and then use the MS Excel VBO - Run Macro (use the same handle created earlier and type in the name of the "macro").
It sounds like what is happening is that the MS Excel VBO is grabbing the data from the Excel Worksheet wholesale.
This is to say that it's accessing your Worksheet table, copying the cell values BUT not the cell formatting data, and then dumping the values into a BP collection.
Since it did not bring along any of the original cell formatting data to reference when it went to populate the collection it's just breaking up the values based on crturn/line breaks. Thus, your collection is organized based on that, and not on the original Worksheet cell.
So, with that said, on to a solution!
Solution 1
Brute force the organization of the incoming Excel cell data to the collection by looping over the Excel Worksheet cell-by-cell.
Run a loop, and in that loop have BP go into the Excel Worksheet and grab the first populated cell it comes across. Run a formatting/cleanup Calculation stage over the data. Dump the cell value into a single collection field.
Repeat.
This is...inelegant, expensive at best, and not at all recommended for any medium to large dataset. But it's definitely the best way to do string manipulation and value comparisons before it hits your collection. Since it sounds like your using a Master template then you as-well know what the expected format of your data should be.
This method will enable you implement Trim(), Concat(), or Split() in a Calculation stage to better organize your incoming data before you dump it into a collection.
This is also basically what I think you're already trying to do, but cell-by-cell instead of Worksheet row-by-row or table-by-table.
Solution 2
Clean up the table data you grab from the website before you dump it into the Excel Worksheet.
This is basically Solution 1, but in reverse. Simply format/cleanup your data before it hits you Excel Worksheet.
I'm not sure this is any better than Solution 1, but, you know, it's something...
Solution 3
Format the cell data IN the MS Excel Worksheet itself.
Basically rearrange the cells and cell data in the Excel Worksheet into a more predictable format by using the Split, Trim, Merge, or other actions included in the MS Excel VBO. You can also do this using the Data - OLEDB utility object, but that requires some pretty solid understanding of SQL syntax.
This would look like this using the MS Excel VBO:
Grab the Excel Worksheet data wholesale and dump into a collection
Count the rows/fields of the collection
Is that number consistent with the desired/expected format of your data?
If not, have the bot go back into the Excel Worksheet and reformat the cells by removing any carriage returns/line breaks/whatever else
Repeat.
However, I'm always reluctant to reformat any original source, as it's then hard to figure out what wrong and where it went wrong when you've changed the original structure of your data. So it's best to always make a copy of the Worksheet before you make any manipulation.
Unfortunately I don't have access to my BP environment at the moment or I'd provide you with the act object actions you'd need to do any of this, my bad. Once I do I'll update this answer.

How to make a value based reference in Excel

I have an excel sheet which fetches the values from an API and these values changes in real time, I mean the row position changes on daily basis.
Problem is when I reference a particular row to write a formula in another sheet and its value changes tomorrow I get the wrong value because it is a cell-based reference and not a value based.
How to handle such scenario?
Excel has several worksheet functions for that purpose. The most popular is VLOOKUP, where you know the column in which your value resides but not the row - precisely what you seem to explain. Google for "Excel VLOOKUP" or simply look in Excel's own Help.

How do I prevent unlocked cells from being selected/editable? (VBA)

I have a very specific question that I am looking for help in answering. I have been researching for hours and I feel like I am not able to find what I am looking for. Below is a quick overview of the criteria that my document must follow:
I am using Excel 2013
I will just be using rows for data input (instead of an excel object
table).
The very top/first row will act as my "column header".
This top row will have AutoFilter enabled.
THE DOCUMENT MUST BE PROTECTED (a must-have)!
I will be using VBA code
Now, the final issue I am having with finishing this document are the last two criteria points that I must have:
The first/top row (column headers) must NOT BE EDITABLE.
Each column must be able to SORT AND FILTER.
Now, in a perfect world, I would just "Lock Cells" for the entire first row that acts as my column headers and when I protect the worksheet I would make sure to check the "Sort" and "Use AutoFilter" boxes.
However, this option does not work because there seems to be an issue when I try to sort the data. If I just filter the data there is no problem, but when I try to sort a column in ascending/descending order I will get an error informing me that I can't sort locked cells while in Protected mode. This is because when excel uses the Sort function, it counts the header as part of the data that is being sorted (I found this out through my research) even though I really just want the data below it to be sorted.
I have been trying to brainstorm on how to get past this issue as well as researching different methods, and I am having trouble coming to a final conclusion. However I have narrowed it down to 2 possible solutions:
I want to be able to keep the cells in the first row officially unlocked to allow the AutoFilter's sort command to work as intended, but make it "behave" like the cells are locked when a user tries to make changes to it (AKA, make the entire row un-editable or un-selectable).
The other option would be to keep the first row locked but somehow have an event in VBA that can tell when a user tries to "Sort" the column, which will then temporarily unprotect the worksheet, follow through with the intended sort command, then protect the worksheet again (apparently though, upon my research there is no such event that can trigger off the AutoFilter's sort command alone).
These 2 solutions are the most logical I can think of based off my research, but if someone out there is an Excel genius and knows another way I am open to suggestions.
Thanks in advance for your help/suggestions,
Travo
Consider using two header rows. The top row would be protected and the second row would facilitate filtering and sorting of the data in rows 3 and below.

Splitting data between worksheets depending on status of Column A

I have been asked to create a database of volunteers in Excel. The main worksheet (called Data) holds all the information – names, addresses, numbers, reference checks, placements, supervisors, etc. What I am trying to achieve is for the relevant information to be moved from one worksheet to another when the status of the person changes.
There would be 5 categories which the volunteers would fall under (column A labelled ‘Status’)
PROCESSING
ACTIVE
ON HOLD
BARRED
STOPPED/RETIRED
What I want to get is a live database so the information would appear on a relevant worksheet whenever the status on the main spreadsheet changes , but I only want some information to show depending on the category…
Each Worksheet would contain columns A-F from the ‘Data’ worksheet and in addition:
Processing would contain columns X-AE
Active: AF-AW
On Hold: AZ-BC
Barred: AX-AY
Stopped/Retired:- BD-BH
I have searched and searched again but I know nothing about Macros (and my IT department is unable to help) So my question is – is this doable and if so is anyone able to help me?
I hope I am making sense and if not I can email across the dummy database with some made up names to show what it is I am trying to create
You can do this using array formulae. This link shows a simple example which provides the basic formula (explained in detail in the linked article)
=INDEX(range,SMALL(IF(col=value,ROW(range)),ROW(1:1)),COLUMN(A2))
Where range is the range of all your data from your main worksheet and value is the value you want to screen for (this changes for each of your sheets) and col is the column on your main sheet that you want to check the values of. Note it is an array forumla so you have to press control+shift+enter after typing in the formula as explained at the bottom of the link.
You will notice that I have changed the formula to say COLUMN(A2) instead of 2. This is so that you can drag the formula across the columns as well as down the rows. You might need to make this COLUMN(A2)-x where x is an offset because your data don't start in column A.
Note that the same applies for the ROW(1:1) part, if your range doesn't start in row 1 then you will need to offset this by some value as well (i.e. something like ROW(1:1)-y)