Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

Everett False posted:

Is getting PowerQuery to source from relative file locations as difficult as the internet is making it look? I just want to be able to copy a folder containing the file and the subfolder to Wherever and still have it work. Having to dedicate a cell to my worksheet's current file location seems like a bonkers solution versus just using something like ./ but maybe I'm the weird one for thinking so.

It's a headache, I haven't found a straightforward way to do it either. I've resorted to making a tab containing a Table with information I want and then making the tab unviewable. Regardless you somehow need to create a Parameter with the file path you want to use

Depending on where you're pulling data from you might be able to construct the path from alternate queries.

Adbot
ADBOT LOVES YOU

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

Rabbit Hill posted:

I have a big spreadsheet which was set up in a clumsy manner, the biggest problem being that it combines two variables in single columns. I want to separate these columns of combined variables into separate columns.

Take this hypothetical example with hypothetical data (color-coded for clarity):



In this example, the spreadsheet is combining the law enforcement agency and the crime into a single column. I want to be able to separate the agency and the crime into two separate columns, and have the spreadsheet look like this:



Is there any way to do this using a formula or some kind (any kind :pray:) of shortcut, so I don't have to do it by hand? The actual spreadsheet I'm working with is really big (imagine 100 agencies, 20 crimes each, for 15 years) and ain't nobody got time for that.

Power Query is absolutely the way to go about this, as others have mentioned.

If you haven't done it before, it's under Data. You can create a new file and Get From Other Source, then point it at the original file. Another way is to make your data into a table by highlighting and Ctrl + T (or Insert -> Table), then using Data -> Get Data From Table

The interface is pretty intuitive even if the process might not be, but you can fiddle with the steps and it will process the entire file how you tell it.

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

C-Euro posted:

Can you define the values that populate the drop-down list without needing to reference cells elsewhere in the sheet? That appears to be my only way of getting more than one value onto the list.

If you want to get super-fancy you can use Tables and INDIRECT so you only have to define the range once, and it'll update automatically if you add anything to the list of acceptable values. You'll still need a range in the spreadsheet for the list though.

If you have a Table named Options with a column named Choices with all your list values, you can go to Data Validation on a cell and set it to " =INDIRECT("Options[Choices]") "

Modifying the table will modify the pull-down list, so you never need to worry it's grabbing the right range. Nice for adding a quick value to the end, or avoiding extra blanks when deleting unnecessary ones. Plus you can sort the column!

With a little more fuckery you can change which table you reference and make dynamically-allocated pull-down lists!

Hughmoris posted:

Any M-code gurus out there using it daily? If so, your thoughts? I've recently started exploring Power Query inside Power BI, seems like a fun little language.

Not daily but I used it a bunch for a custom project, it's a fun way to attack some problems sideways

For example

Wandering Orange posted:

Add the CSV file as a data source (Power Query > From File > From Text/CSV), ignore whatever happens in the first dialog and hit the Edit button to open up the PQ editor. Then on the far right-hand side, click the gear icon to the right of the Source step on this new query and play around with the Line Breaks and Delimiter options. You've kinda already done this so it may not work either. The Transform > Split Column > By Delimiter option may be useful too.
Data cleaning like this is a great application for power query/M-code

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

Jack the Lad posted:

Is there a way to write the name of a named range as text in a cell, then pass the contents of that cell to a formula that parses it as the named range?

For example I want to put BobsFaveFoods in A1 and then use =SUMPRODUCT(COUNTIF(B2:B10,A1)) instead of =SUMPRODUCT(COUNTIF(B2:B10,BobsFaveFoods)) so that I can have this across a bunch of rows/tabs and change which named range I'm referencing on the fly if possible.

Really stumped on this but probably just being stupid.

Using INDIRECT and naming cells will probably do what you want

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

Xenoborg posted:

Is ther a way to resolve all of the references in a formula? For budgeting, I have a cell of all my credit cards bills due that is =$F$19+$F$20+$F$21+$F$22. When all statements for a month are in, I paste values, and it becomes a flat -2500, but what I really want to see is for it to bring in all the refs and make it like =-1000-1000-200-300, which would make checking a lot easier when something is wonky.

Probably not exactly what you're looking for, but you can use the Evaluate Formula to step through the calculation and see where things break

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost
It's not the most sophisticated way, but it's probably about the speed you're operating at based on your description. Use Column Groups to either make the master sheet hide the calculations columns, or insert blank columns in the Input sheet and collapse them until you're ready to copy/paste. There's a button to (un)collapse all which will save you time either way.

https://www.excelcampus.com/tips/groups-outlines/

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

disaster pastor posted:

I must either be explaining this wrong or completely misunderstanding, sorry.

No, the column order has to be maintained, unfortunately.

This is 3000–5000 rows per week. That'd be a lot of =s, and a bunch of N/As when some of them were blank in the input sheet. (It's also a fresh CSV every time, but I could rename it.)

This didn't work. I created a template sheet with the columns from the master sheet, grouped the columns that don't appear in the input, collapsed all, then tried to copy and paste from the input sheet. The data pasted into the collapsed columns.

If a visual would be more clear, let's say this is the master sheet:


And this is the input sheet:


I'm looking for a less manual way to get here:

from where I could just drag the formula columns down and be done.

You'll have to use your template sheet, it's going to replace your input sheet. If you're testing things out, first copy your input sheet data to the template sheet manually. Copy from the now filled out template sheet (presumably with columns collapsed) and paste into your master sheet and everything should be in the right spot.

If that works, just provide the template sheet to your users as the input sheet. With columns collapsed it should be identical for their purposes. And since you're dragging down (double-clicking the + drag) formulas anyway, any errant data should be overwritten

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost
Separate post for a separate post

GD_American posted:

Similar question. I have to copy info from a program and paste it into an Excel tab every day, to try and keep track of a specific type of transfer we have a quota for. (Our MI sucks)

I've got a different tab with enough formulas that pull from the tab with raw data to get the basic information we need (# of transfers, and who has fulfilled their quota/who hasn't). The table always ends up with some garbage in it, but I can live with that.

Since I'm trying to expand use of this sheet to people who are more scared of Excel (and just polish it up), and I'm weaksauce on the VBA side, would the best option be an input form, where they can hit a button to paste clipboard contents to cell A1 of the (hidden) cell for the raw data? I've just been copying and pasting with destination formatting so far.

Follow-up; is there a way in the macro to then have the data clipped at a specific point before and after the info I need? When I copy from the website, there's a few lines of junk on top and on bottom, and I just need the stuff that would, in any sane program, be exportable to text/excel.

You might want to look into doing a Power Query. You can set things up so that users just have to place an excel file (or even some other format, like .txt, based on how that other program makes its output!) into a specific folder and the Power Query will filter, process, format, and calculate automatically.

This video goes over some of that

https://youtu.be/Nbhd0B5ldJE?si=TCJtJZdeF22oRvVj

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

disaster pastor posted:

Unfortunately, the input sheet is a system-generated CSV, so I can't replace it this way.

The Power Query method might be a good idea for you too then.

If you find yourself repetitively processing data the exact same way on a frequent basis it's a good method for automating all those steps.

Adbot
ADBOT LOVES YOU

DarkHorse
Dec 13, 2006

Vroom Vroom, BEEP BEEP!
Nap Ghost

Azran posted:

Hey thread, quick question. My mom recently opened up a wholesaler and given we live in an economy with rampant inflation, keeping up to date on supplier prices eats up a lot of her time. I'm very Excel-illiterate so I don't know if this is possible but it's essentially black magic so might as well ask: is it possible to link a value from a website (which appears on the page source) to a cell and have it stay up to date with any changes made to the website?

I might be sounding like a broken record at this point but you can do it with Power Query

https://youtu.be/j_ONaX0Ettw?si=jKoLtcd7SHEN8jWo

VBA may be more efficient and elegant but this requires less effort or expertise.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply