This is very cool. I submitted a hard problem it wasn't able to solve - required doing a match where the lookup array was two references (each created using an indirect on a range compared to a value) are multiplied together (basically, creating a list of 0's and 1's to find where two criteria are both true).
But it did come up with an index match formula that was close to performing one of the search criteria properly, so that was pretty cool.
EDIT: If you're finding this tool helpful, there's a donation link on the website. The author is open about the costs to run this site (visible near the top of the page) and those costs are adding up. Consider chipping in a couple bucks.
Here's a somewhat simpler (but still tricky) problem it didn't solve:
It answered:
Which finds the length of the longest string in column A.
The actual longest string in column A could be found by:
Edit: some people have asked for explanation on this formula. I wrote an answer in a response, and have copied it below for more visibility.
It's really hard for me to understand how people can write excel formulas while simultaneously being afraid of programming.
The excel shits harder.
You would rarely see someone use that formula in the wild. What you would most likely see is a hidden helper column to get the length of each cell and take the max of that.
Excel is as easy or hard as you make it.
Ah. So like programming then.
Except programmers are lazy bastards.
Accountants are another beast altogether.
Behold my nested If statements!
Years ago I worked under a guy who managed the entire company on spreadsheets. Things that could have been a simple VLOOKUP were instead done using hundreds of nested IFs. He was a total asshole so I never told him about vlookup.
Don't worry... He wouldn't have changed his ways. They never do.
Just replace the file with vlookup instead, on the last day of employment.
It's not so much that he wouldn't have changed his ways as after a while they don't know how to change their ways.
So dumb question time. The fuck is a VLOOKUP?
It's a function that returns a value from a column by looking up a value from another column.
This explains it better than I could myself
Its sibling hlookup does the same but with rows.
When someone says “BEHOLD” I always think of the mad scientist guy in the opening of Aqua Teen Hunger Force shouting BEHOLD and opening his lab coat and dropping his shorts.
Edit: Dr. Weird, #1 in da hood
This time! Will be different!
It's if statements all the way down, baby!
instinctive cough unwritten murky chop erect light brave cagey mourn -- mass edited with https://redact.dev/
If there are 1000 people making those clicks, and they all save a few seconds, you have made the world a kinder place
All at the cost of one test automation engineers soul. This is fair.
I think most us back those together in autohotkey or something and just mostly keep it to ourselves. To much of a hassle to promote
Also it's like...my special secret that lets me finish work mysteriously early. If we're good friends, maybe I'll hook you up but...
ADHD?
In my interviews, I’ve been asked how I would rate my proficiency in Excel. I always reply with “well I thought I was pretty advanced until I saw my analyst friend use Excel. So now I’m expert level.”
I prefer to rate my proficiency in short prose, but I can put it in a spreadsheet if I have to.
I ask this question when I interview and ask people to pick a number. Most people say 7 or 8. Then I ask about the most advanced thing they can do in Excel. The number of people that say “spreadsheets” or “formulas”is incredible.
[removed]
So when I answer “expert”, the follow up question is always “can you do pivot tables & VLOOKUP?”
Seems if you can do those things, most places are happy. (Dependent on the position you’re applying to, of course.)
But I also add “I can do some macros, too” which normally gets me a “oh that’s great but no we don’t use a lot of that here”.
Yes. That’s good.
I am neither, for better and for worse.
I nest my VLOOKUPs in my IFs based on multiple data validations and other IFs.... I went to school for art, how did I get here.....
From tortured soul to torturer of souls
My God
Accountants aren't the only users of excel.
Source: civil engineer
Indeed!
Source: audio engineer
civil engineer is a contradiction in terms LOL
How do you figure that?
Accountant here
ARRRRRGH WHY THE FUCK WON'T IT STOP PUTTING MY LONG ASS NUMBERS INTO SCIENTIFIC NOTATION WHEN I OPEN MY .CSV FILES TO EDIT SOMETHING???!!!
ive been working on some political bs and one of the few absolutely essential roles that must be filled (notably by someone else since i cant do it) is "accountant".
and not just to track data. because these weird bastards seem to like working with numbers and making them add up correctly, and that is essential to the health of any program of any sort.
Excel is used so broadly beyond Accounting, I think many people would be amazed with the amount of extremely important corporate data that is created and stored using Excel. Example, Consumer Product companies use Excel for nearly all sales, planning, allocation, finance, and even marketing data. Excel will outlive Microsoft mark my words
Helper columns for prototyping, final version condenses it all into single line formulas so when people try to steal my workbooks they nope out
I have never felt so seen in my excel coding methods
late to the thread but yep, nesting formulas in one cell is the anti-edit-by-coworkers once they learn that legacy sheets are not locked by default..
works every time lmfao, some even started on taking excel seriously as a hard skill so that's nice
This is me doing any complex string manipulation in SQL.
You might find AI2sql helpful; it’s an easy-to-use tool to help you generate SQL.:) http://app.ai2sql.io
I honestly don't think I'd find writing an AI parseable sentence for this kind of stuff any easier than writing the code in the first place haha!
Lol
I guess that disqualifies your use of LET.
Lol I use a very similar formula in my work
=index(x:x,small(if(y=z,row(x:x)-row(x)+1), column(x1)))
Returns values horizontally
Nice. There's plenty of ways to do the same thing. I always try to make it as simple as possible and never commit formulas like that to memory.
I’d love suggestions tbh, it’s dumb the purpose I’m using this for but if you can save ram capacity it would make life easier
Wait, you can make helper columns hidden? that's a great idea, I'm going to do that right now on a file I made for work.
You could even pull them into a different sheet.
Or you can write your own functions and embed a script into the document.
Hidden columns works for what I'm doing, all the hidden functions are just simple w*x=y intermediate results to do x/y=z results (we only care about z)
Any self respecting writer would consolidate/nest that helper column into the formula though, no?
I'm not sure what you mean exactly but i would much rather have a hidden helper column when someone else is trying to figure out what got messed up with the formulas in a year. It's fun at first to figure out how to wrap everything into one big formula, but it's more fun to not want to throw it away and start over when you need to fix something later.
Yea I almost always go for helper columns instead adding on to formula complexity. There is very little “cost” to just adding a column to make answering the question easier in steps, and allowing others to follow your work if their excel knowledge is weaker
If it’s just for my own use? Then sure, I’ll throw on my wizard hat and do some wild shit just to see what I can do, but most of my work has exponentially more impact if it’s both useful and shareable to the masses 😁
You'd think so if you didn't have loads of experience of debugging those combined formulas. Novice programmers make the same mistake, specially if they're from a mathematics background - they want information density and things to look tidy. I think people have an inner drive to build something clever and impressive.
Expert programmers try to work against this compulsion and write code that describes how and why it's done, so that future readers can easily understand and are impressed with its simplicity. Once you're good at logic that's the next step: choosing good verbs, nouns and adjectives and putting them together in a way that tells a good story. It's what makes software more about English than mathematics.
Nah, helper columns are really great for checks along the way.
Depends the use case, quick and easy way is to do what I mentioned. If it's going to live in some report, then yes, a formula would make more sense.
But Excel people are not "writers", unless you are talking specifically about vba. More modelers/problem solvers
So kind of like extracting a function
Why though? It's the same run time of N
Or is it just 'harder' to remember one way
Stackoverflow section on excel and VBA is just easier to use and more forgiving
While condensed, results are instant, debug errors are descriptive (I rarely experience that outside of Autohotkey and sometimes Python and Excel tells me when I forgot a parenthesis), and the lines are somewhat short and autofilled. In regards to macros, I concede.
Ditto for Excel people who don't take the extra, arguably easier step, of learning SQL. You can write queries that so work in other environments and they are infinitely easier than the standard formulas, IMO... plus there are query type structures even on clones like Google Sheets.
Excel isn't really difficult, it is just obtuse for what people try and use it for. It isn't a CRM. You can, I have seen, make millions and millions and millions of dollars using nothing but Excel on your back-end (essentially), so the point I am making is moot, just that those same Excel wizards would have probably hit billions with a bit of SQL :).
cries in As400 greenscreen
Hey, don’t knock the AS400. You can create some pretty awesome queries using the WRKQRY in the command line. =)
It's so hard getting people to learn PowerQuery, where you can at least do SQL style joins, and it feeds into Excel or PowerBI. You have a nice UI to even do ETL without much need to learn programming.
Hey, I totally hear you! Also AI2sql is a great way to do some pretty advanced stuff right in SQL. It's so easy, too—you can just write your questions and click a button to generate SQL . http://app.ai2sql.io
You might find AI2sql helpful; it’s an easy-to-use tool to help you generate SQL.:) http://app.ai2sql.io
I played around with this and some other AI programming tools (been a software developer most of my life), and I think they are great for basic use, definitely.
I am currently looking for an AI that can take any set of data (like a database of tables) and use machine learning to guess about relationships between tables and data up various metrics based on the data it finds.
Could be sales data from a mechanic shop, or widgets a factory produced last quarter.
Looked in on it a bit on my own to see if I could develop something like that, and I think I would have better luck building a script that just tries to guess a lot of things and procedurally generate content in a similar manner, but I feel like an AI that can do this is maybe out there now or right around the corner.
Serious answer:
Excel is already installed and being used.
Programming takes a smart nerd to do.
Programs are long and complicated. An additional excel formula is only n + 1 harder than your existing spreadsheet.
Much easier to do a quick and dirty fix in excel that you know rather than learn how to program.
It's also really hard to convince the 60+ year olds who barely even understand excel to use a program they don't understand (literally any executable from actual programming). So writing janky ass excel formulas, or incorporating one-button-click macros is about the closest you'll ever get.
[removed]
Isn't that programming language called Visual Basic for Applications?
Yeah... It's not exactly python because... it predates it and is natively supported in Windows? Visual BASIC gets a lot of flack but it's a Turing complete language and for a hot minute (C# kind of killed it) there was a 50/50 shot that any given Windows app you used was written in it.
VBA is basically the same thing w/o the RAD GUI part.
Me is that guy who's the most proficient in Excel and Google Sheets in the company but soooo afraid of coding. Basic HTML or tracking code is fine. But anything pass data layer is a wilderness for me
Learn elm
I'm the complete opposite. I love learning new programming concepts and applying them, but I can't stand working in Excel. And I totally admit that it's probably because I haven't spent the time to actually figure out a good workflow.
Python and SQLite is far more powerful than excel
Is that real? I love writing out formulas and getting crazy in excel… deathly afraid of programming and worried I’ll get lost with the different C+, C++, Java, etc (I don’t even know if that’s right)
1000%.
Literally just try python. I personally don't like using python, but for reasons you'll probably never care about.
Excel is just programming for business people. Shit gets actually way more complicated than just writing a script.
I remember a talk where a guy said Excel is the most popular functional programming language.
It is technically true. Excel has no side effects, any cell can only reference any other sell, etc.
If you are good at excel, start with recording some macros and studying that vba code until you know what they are doing. There's lots of free tutorials for vba programming as well as python.
Just learn Python
I’ll give it a try!
Just so you know, Python was specifically built to be easy and simple.
It took me maybe 2 weeks of learning to be able to use it on my job.
What kind of things do you use it for at work? I played around with it years back on Codecademy but never really figured out how to transfer it to something useful in the real world. I'm reasonably proficient with Excel, PowerQuery, VBA and SQL, but they're kind of already part of systems I'm using so a bit easier to figure out.
Maybe this book is useful to you? The web version is free: https://automatetheboringstuff.com/
Thanks! I'll give it a read.
I'll give you the example in R (similar if you're use python).
which.max(nchar(df$A))This is base R. You just install the software and it works. It is backward compatible so it works on R 1.0 from decades ago.
explanation:
df is the name of the spreadsheet. $ grabs the column called A. Then "nchar" count the number of strings. R by default works on a column or row, so nchar(df$A) will give you a count of length of strings for the whole column. Once you have that, which.max() returns which element is the maximum.
Tell me that shit is harder than whatever the crap is EXCEL doing.
Also, with scripting language you keep a copy of what you have done. Have you ever written down what you have done with this dataset or that one? Well with programming you don't need to because it's all in the code, and you don't have to click on the cell to read it.
Last, we don't code in c/c++/java for data processing. You are fine with something much easier like python or R unless you are doing algorithm development. And let's face it. You are using excel. You are doing data science.
Not so hard, It something like regexp for me.
Don't take the name of that stuff in front of me, you just put me into an anxiety attack
Well that's how we end up doing macros but real programmers bully you if you call that programming
I'm not afraid. It's just that I can cobble this together in an hour doing incremental stages and getting instant feedback if I write something wrong.
Meanwhile, programming requires me to spend at least a few days to get to know everything and figure out how to do things I do in excel already. That's simply not feasible since I get an hour or two per week to sit down in front of a computer at work and I'm not going to learn programming in my unpaid free time.
You get instant feedback in programming, especially if we're talking about something like "data in/data out".
The counterpoint to "I'd have to spend time" is of course that by avoiding learning the better tool you are actually costing yourself more time in the long run.
It's like saying you're going to jog to work because learning to ride a bike takes time and effort. That's true... at first. Then you save a significant amount of time after you've developed the basic skill.
If this skill is for work why wouldn't you develop it at work? What if you spent 10-20 minutes a day just learning some basics? At the end of the year that would be a 40+ hours of time you spent on learning. Sure, it would be slow... But slow and steady is still progress.
That's the company's time. I'm pushing myself every day and if I got more efficient, they'd surely find more things to pile on to my already overfilling plate.
I am way past basics. That's the problem. Another problem is 10-20 minutes a day is not something I have. I'm squeezing 9 hours of work in 8 hours daily and if I managed to do it better, I'd be tasked to squeeze 10 hours instead. It's not really worth the stress for minimum wage.
Well, that is me.
Exactly, this would be so much easier in Python
Nobody is interested in python scripts in the workplace. They want an excel sheet they can operate.
Productivity >>>> fancy script which achieves the same thing.
Excel is algebra with words.
programming is Ad-Libbing with fractals.
I've been slogging through a colleague's VBA code. There are definitely things that could be replaced by library calls in a modern language..
I think it's an awareness thing. I've been using advanced excel shits to manage our data in production foe the longest time and I just recently learned how Python basics are just the same formulas I use in excel. Now I'm into studying data engineering because of it
This is me. I will write paragraphs in excel and I’m just now getting to python. It’s shockingly similar, but for a reason I can’t define, excel makes more sense. Something about it just clicks and I can’t put my finger on it.
It's all a frame of reference. Functionally data manipulation is data manipulation.
The level of depth you can get to with a general programming language is significantly deeper* with less complexity to get to that point
*Excel is turing complete, technically you could compute any problem with it, but like cmon.
I know it's more of a personal preference, but I'd prefer to use an XLOOKUP
=XLOOKUP(MAX(LEN(A:A)),LEN(A:A), A:A)
Thats why I python now
https://www.geeksforgeeks.org/reading-and-writing-xml-files-in-python/
and, I'm out.
I find R to be an easier language to transition to from Excel.
I don't know why I can't figure this formula out. I need the opposite of this website. One that breaks down formulas.
Holy fuck, that's a smart formula. Also goes to show how complicated Excel can be - in C#, you'd just write array.MaxBy(s=>s.Length), and similarly in many programming languages
Can you explain this for me, please? I do a lot of Excel formulae and I don't think I've seen an equals sign used inside a formula like that so I'm not sure what it's doing
Sure!
The calculation happens from the inside out.
First, expand all the A:A as arrays of numbers that these functions act on.
LEN() acts on a single cell, so it acts on each cell individually. LEN(A:A) creates an array of numbers, with a value in each cell equal to the length of the string in the corresponding cell in A:A.
ROW() also acts on a single cell, so it creates an array of numbers with values equal to their row number (ie, 1 2 3 4 5 6 etc).
MAX() acts on an array, so when given LEN(A:A), it creates a single value, the length of the longest string in the array.
So when we have:
We compare an array (on the left) to a single value (on the right), which creates an array of booleans. We will have TRUE values on the cells that are tied for the longest string in A:A.
When we multiply a boolean array by a numeric array, we treat the boolean array as 1s and 0s. So, when we multiply our boolean array by the ROW(A:A) array, we're left with an array of 0s (where the string isn't the longest) and row numbers (where the string is the longest).
We want a single value from that, so MAX() will get us the row number of the bottom-most longest string.
Finally, we feed that row number into INDEX(array, row#), and get our result.
Cheers!
That's fantastic, thanks. I've never thought to include arrays in my formulas. I'd always expand them out physically, generating the actual length numbers for each row in another column, then taking the max of that column as the row parameter for an index formula. This is going to change some things, although I'll still probably "build out" more so my mistakes jump out at me haha
Arrays are great, I would recommend getting familiar with sumproduct to avoid CSE arrays as well as experimenting with boolean tricks when you need something with a little more flexibility than Index/Match.
Natural language processing seems to need some more work here (but it's good!)
I asked "match columns a, b, and c to d, e, and f" and got a good formula. However. Adding "match columns a, b, and c to d, e, and f, and add one day to the date in column d" did not seem to work.
So basically it's Google?