3 ms·
Will it give us beauts like this?: =IFERROR(IF(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(SEARCH("Banner",AC5),SEARCH("EBL2",AC5)),SEARCH("Movie Art",AC5)
by hermitcrab 4y ago
Will it give us beauts like this?:
=IFERROR(IF(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(SEARCH("Banner",AC5),SEARCH("EBL2",AC5)),SEARCH("Movie Art",AC5)),SEARCH("Use as is",AC5)),SEARCH("TTT",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1)<IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(SEARCH("Banner",AC5),SEARCH("EBL2",AC5)),SEARCH("Movie Art",AC5)),SEARCH("Use as is",AC5)),SEARCH("TTT",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1),MID(AC5,IFERROR(IFERROR(IFERROR(SEARCH("Customs",AC5),SEARCH("Custom",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1),IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(SEARCH("Banner",AC5),SEARCH("EBL2",AC5)),SEARCH("Movie Art",AC5)),SEARCH("Use as is",AC5)),SEARCH("TTT",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1)-IFERROR(IFERROR(IFERROR(SEARCH("Customs",AC5),SEARCH("Custom",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1)),MID(AC5,IFERROR(IFERROR(IFERROR(SEARCH("Customs",AC5),SEARCH("Custom",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1),IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(IFERROR(SEARCH("Banner",AC5),SEARCH("EBL2",AC5)),SEARCH("Movie Art",AC5)),SEARCH("Use as is",AC5)),SEARCH("TTT",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1)-IFERROR(IFERROR(IFERROR(SEARCH("Customs",AC5),SEARCH("Custom",AC5)),SEARCH("Generic",AC5)),LEN(AC5)+1))),"")
(source: https://www.quora.com/What-is-the-longest-excel-formula-you-have-ever-created-for-one-cell https://www.quora.com/What-is-the-longest-excel-formula-you-... )
- meltyness 4y agoDon't even think about getting a CSE right the first time.
- jmkni 4y agoFor fun, I took this formula and asked ChatGPT to convert it to a VBA Function (with comments): Function extractText(cell As Range) As String ' Declare an array of search terms Dim searchTerms As Variant searchTerms = Array("Banner", "EBL2", "Movie Art", "Use as is", "TTT", "Generic") ' Initialize start and end positions to 0 Dim startPos As Long startPos = 0 Dim endPos As Long endPos = 0 ' Loop through search terms and find the first occurrence of any of them in the cell For Each searchTerm In searchTerms startPos = WorksheetFunction.Search(searchTerm, cell) If startPos > 0 Then Exit For End If Next searchTerm ' If none of the search terms were found, try finding "Customs" or "Custom" If startPos = 0 Then startPos = WorksheetFunction.Search("Customs", cell) If startPos = 0 Then startPos = WorksheetFunction.Search("Custom", cell) End If End If ' If none of the above were found, try finding "Generic" If startPos = 0 Then startPos = WorksheetFunction.Search("Generic", cell) End If ' If none of the search terms were found, return an empty string If startPos = 0 Then extractText = "" Else ' Loop through search terms and find the next occurrence of any of them after the start position For Each searchTerm In searchTerms endPos = WorksheetFunction.Search(searchTerm, cell, startPos + 1) If endPos > 0 Then Exit For End If Next searchTerm ' If none of the search terms were found after the start position, set the end position to the end of the cell If endPos = 0 Then endPos = Len(cell) + 1 End If ' Extract the text between the start and end positions extractText = Mid(cell, startPos, endPos - startPos) End If End Function Edit: Sadly this doesn't work at all lol, and after half an hour of prompting ChatGPT can't figure out why, it just gets stuck in a loop :-(
- capableweb 4y agoDid you actually try running the code vs the formula and compared it works the same way in the expected cases? The times I've tried using ChatGPT, it has mostly giving me code that seems like it'd work but doesn't.
- dmurray 4y ago"ChatGPT, can you give me some test cases for the code?"
- omgomgomgomg 4y agoThis is interesting, would ChatGPT know to wrap everything in am iferror and can it create new sheets and book and save them as csv on any os? This took me a full week to make it work and got me a raise, but it is so hacky, I rather not want to maintain that. Can it run cron jobs, handle api responses etc?
- logicallee 4y ago(not OP) over on reddit people are saying it is fantastic for giving them excel formulas they ask for. I guess it means the formulas work!
- hermitcrab 4y agoThat is one of the big issues with AIs like ChatGPT though. It gives you a plausible sounding answer, but that answer might be total BS. It doesn't tell you what degree of confidence it has in the answer. Maybe the formulas it gives are right 100%, 99% or 0% of the time.
- Sharlin 4y agoYes, and I think that in order for helper AIs like ChatGPT to really break through, people (especially in marketing) will have to learn to embrace confidence intervals, or at least some quantitative concept of confidence. The AI already knows how confident it is in its prediction, it's just a UI question. If plain numbers are too nerdy or Spock-y, at least tell me something like "I'm fairly sure" or "I'm not sure, but..."