Automatically Replace Value When Entered

  Рет қаралды 1,969

Spencer Farris

Spencer Farris

Күн бұрын

Пікірлер: 25
@MichaelCorbettUK
@MichaelCorbettUK Жыл бұрын
A great video! I really like the way that you think out loud and go through your thought processes with the viewer.
@SpencerFarris
@SpencerFarris Жыл бұрын
Thanks! I figured seeing the human side can be better than just a pre-made perfect script. I actually don't pre-write any of the scripts I video
@markonakic8870
@markonakic8870 4 күн бұрын
Hi Spencer, very well explained and detailed instructions, thank you very much! Google sheets don't have option to input special characters, I was wondering about a script for find and replace. My idea is to have "gl_a" as abbreviation for alfa, which is CHAR(945), but have no idea how to make that work, any help is highly appreciated!
@junesqueek
@junesqueek 21 сағат бұрын
it worked, thank you! if i only wanted it to work within one sheet though, how would i do that? i have sheet1 and sheet2 but i only want the script to apply to sheet1 and not sheet2.
@lapneto
@lapneto Жыл бұрын
Very cool. Thanks for sharing!
@BaherSaid
@BaherSaid 4 ай бұрын
Great video man, this can work for abbreviations as well which is awesome, I just have a question, which trigger should I enter if I want to do the same but instead of onedit I want it to happen also on copy and paste, because right now when I paste the value nothing changes
@SpencerFarris
@SpencerFarris 4 ай бұрын
Does it not even work when you paste a single value?
@MichaelDaniels
@MichaelDaniels Жыл бұрын
Nice video. Thanks
@ward90xc
@ward90xc 11 ай бұрын
@SpencerFarris Love this! Would it be possible to have a protected sheet, where the script did not run? For example, I have an appeal order form. The data is being entered via a Google Form and I don't want to touch the raw data. I want to create a summary sheet, where the product description is converted to a SKU. So "T-Shirt - Large" would be converted to "TS-LG-0001" automatically.
@Caleb_3D
@Caleb_3D Ай бұрын
Thank you so much for making this video! This function is exactly what I need for a school project. Unfortunately, the code doesn't seem to be working for me. I opened a new sheet, opened the apps script, pasted the code from shane0163's comment, went back to the original sheet, typed "o1," and it didn't replace it. This was after trying to follow the tutorial and experiencing the same issue after the test at the 3 minute mark, where it just didn't replace it. Do you have any idea what's going on?
@SpencerFarris
@SpencerFarris 20 күн бұрын
can you share the spreadsheet with me? spencer.farris@gmail.com
@Caleb_3D
@Caleb_3D 19 күн бұрын
@@SpencerFarris Unfortunately, I no longer have access to the blank sheet that I tested it in, and when I tried shane's code in a new blank sheet, it worked as expected, but my alternate solution does work (I just have to type the prices in manually instead of the names). I will be saving this video for if I ever need it, so thank you for making it!
@SpencerFarris
@SpencerFarris 18 күн бұрын
@@Caleb_3D Glad you got it sorted :)
@shane1063
@shane1063 4 ай бұрын
this was great. however when I tried it didn't work I'm assuming its cause I'm trying to replace an alpha numeric value with a word value. example I'm trying to replace "a1" with "cheerios"
@SpencerFarris
@SpencerFarris 4 ай бұрын
That should work fine. Paste your code?
@shane1063
@shane1063 4 ай бұрын
@@SpencerFarris function onEdit(e){ if (!e) throw "Do not run from editor, the function runs automatically whenever an edit is made" autoReplaceValues(e); } function autoReplaceValues(e){ if (e.value != "o1") return; e.range.setValue("george"); } function autoReplaceValues(e){ const values = ["o1","o2","o3","o4","o5","o6"]; const index = values.indexOf(e.value); if (index == -1) return; const replacements = ["george","dan","chris","david","james","paul"]; e.range.setValue(replacements[index]); }
@shane1063
@shane1063 4 ай бұрын
@@SpencerFarris actually hold on. i swear it wasn't working the other day. god programming is. i changed nothing now everything is fine
@SpencerFarris
@SpencerFarris 4 ай бұрын
@@shane1063 Hooray!
@MichelNabil
@MichelNabil 3 ай бұрын
Thanks, a lot for your awesome hacks excuse me, I'm beginner to scripting using google App sheet. The script in the video doesn't work when I copy and paste the cell values into the sheet I want to change. for example, when I paste lots of cells containing "M", I want them to automatically get changed to "Male" and so on... but it only happens to the first cell, not the rest in column. Also, I want to only trigger this script in a certain sheet, is there a way to do so? This is the current applied script: function onEdit(e){ if (!e) throw "Do not run from editor, the functipon runs automaticallly whenever an edit is made" autoReplaceValues(e); } function autoReplaceValues(e){ const values = ["M","F","O"]; const index = values.indexOf(e.value); if (index == -1) return; const replacments = ["Male","Female","Other"]; e.range.setValue(replacments[index]); }
@SpencerFarris
@SpencerFarris 3 ай бұрын
This script is written for an edit in a single cell, not mapped along an array To only use it on a certain sheet add const src = e.source.getActiveSheet(); if (src.getName() != "sheet name") return; put that before any of the actions in autoReplaceValues
@brandonpeterson8154
@brandonpeterson8154 Жыл бұрын
Thank you for this. is there a way to do the same thing with data that is auto filled from a google form?
@SpencerFarris
@SpencerFarris Жыл бұрын
You could use an On Form Submit trigger
@THDYoung
@THDYoung Жыл бұрын
nice
Highlight Cell vs Row
3:42
Spencer Farris
Рет қаралды 306
Sort Range When New Data Entered
9:30
Spencer Farris
Рет қаралды 726
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 123 МЛН
Python in Excel vs. VBA - What You Should Learn in 2024!
10:05
David Langer
Рет қаралды 54 М.
Stop Wasting Time! 3 Easy Ways to Remove Blank Rows in Excel
10:20
Leila Gharani
Рет қаралды 95 М.
When Should You Use the Hash Sign in Excel Formulas?
10:53
Leila Gharani
Рет қаралды 1 МЛН
Google Sheets: 2-Way Sync Tutorial
8:09
Spencer Farris
Рет қаралды 16 М.
Advanced Formula Magic: Running total by row with dynamic arrays in Excel
10:15
Google Apps Script: Take Action Based On Formatting
12:51
Spencer Farris
Рет қаралды 107
Google Sheets / Apps Script - Move Data Down with Dropdown
9:00
Spencer Farris
Рет қаралды 356
Google Sheets - Find and Replace with Functions or Without SUBSTITUTE, RegEx, Wildcards Tutorial
24:49
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 67 М.