Office Scripts
489 TopicsUsing mode with several criteria
Hello everyone! I'm currently treating some data before I send it to do some machine learning. I have the following data: id Ano mês data_inversa dia_semana horario uf br km municipio causa_acidente tipo_acidente classificacao_acidente fase_dia sentido_via condicao_metereologica tipo_pista tracado_via uso_solo ano pessoas mortos feridos_leves feridos_graves ilesos ignorados feridos veiculos And I created a new table to summarize this data for months instead of accidents, here are the columns: BR KM Ano Mês Clima (Moda) Tipo Pista Acidentes Veículos Ilesos Feridos Leves Feridos Graves Mortes Causa (Moda) Risco What I want to do is calculate the mode of condicao_metereologica for each combination of BR, KM, Ano and Mês. But I can't wrap my head around on how I could do this. Any help is appreciated! Let me know if I made anything not as clear as it is in my head xD46Views0likes1CommentScript changing dates to text
I"m trying to make a script to transform a column with dates to text. Normally i would just use the TEXT function but the issue is that the new text values need to replace the old date values. The dates are now in three columns with the number notation date and it needs to be a text with the form "dd/mm/yyyy". Since i need to do this for at least 50 files i tought about using a script to make a new column & use the text funcion to get the new values for all three columns Change the date notation on the new values to text copy the new text values to the old column Delete the new column. The issue i meet is at the second stap that the values are in a table and are not all the same length. At the moment i have this for first step in a script function main(workbook: ExcelScript.Workbook) { let selectedSheet = workbook.getActiveWorksheet(); // Insert at range E:E on selectedSheet, move existing cells right selectedSheet.getRange("E:E").insert(ExcelScript.InsertShiftDirection.right); // Set range E2 on selectedSheet selectedSheet.getRange("E2").setFormula("=TEXT([@Geboortedatum],\"dd/mm/jjjj\")"); // Insert at range Q:Q on selectedSheet, move existing cells right selectedSheet.getRange("Q:Q").insert(ExcelScript.InsertShiftDirection.right); // Set range Q2 on selectedSheet selectedSheet.getRange("Q2").setFormula("=TEXT([@[Datum Resultaat]],\"dd/mm/jjjj\")"); // Set range S2 on selectedSheet selectedSheet.getRange("S2").setFormula("=TEXT([@Startdatum],\"dd/mm/jjjj\")"); } And as second step function main(workbook: ExcelScript.Workbook) { let selectedSheet = workbook.getActiveWorksheet(); // Set format for range E:E on selectedSheet selectedSheet.getRange("E:E").setNumberFormatLocal("@"); // Set format for range Q:Q on selectedSheet selectedSheet.getRange("Q:Q").setNumberFormatLocal("@"); // Set format for range S:S on selectedSheet selectedSheet.getRange("S:S").setNumberFormatLocal("@"); } But i'm stuck at the third step. If there is an easier method that would be fine toSolved146Views0likes5CommentsExcel macro VBA issues
Hey guys. - I wrote a macro, which contain other macros using Call orders. If I running the macros separately everything ok, from the main macro one of them didn't running it's like it skipped from the list. Reason unknown. -On running I can see 4 application window get visible, and those didn't connect any kind of application. Also a Clipboard error message get visible, but I get a Clipboard cleaning macro, which several times cleaning the Clipboard, so it can't be. It's like a hack, or something which I don't recognize. - One a sheets called Total, I can't use the built in group function and can't collapse the selected section so the project I working on lost functionality. I didn't make any change on that side, but previously it was useable. Thanks for help in advance. Cheers. Zsolt87Views0likes2CommentsExcel script not updating the Refresh All button
I've used ChatGPT to create an Excel Script to effectively click on the Refresh All button to update a Query. However nothing seems to happen. Can someone confirm if this functionality not available yet? Many thanks JamesSolved192Views0likes4CommentsEXCEL FORMULA HELP
I need help. I have attached the sheet I'm working on. I need to pull the data in column B (CLIENT) from the MAIN sheet to the respective individual sheet based on column E (PREPPER). For example, if the data in B4 says 'Jason Smith' and E4 says 'Jon'; I need it to go to the JON sheet in cell B4 but not show up on sheets JANE or MARLA. Help please!! Thank you! :)Solved301Views0likes5CommentsExcel’s "Very Hidden" Sheets… even the Unhide menu can’t find them
Just learned that Excel has a "Very Hidden" sheet state. Unlike normal hidden sheets, these don't show up in the “Unhide” menu at all. To create one: Press Alt + F11 to open VBA. In the Project Explorer, right-click a sheet → Properties. Change Visible from -1 (Visible) or 0 (Hidden) to 2 (Very Hidden). Now, only VBA (or the Developer tab) can bring it back. Perfect to keep things tidy or prevent accidental edits. Did anyone else know about this ninja-level Excel feature?99Views0likes1CommentTech Gurus I need your help.
I am trying to figure out a way that if the space on sheet 1 A1 has a 1 it will be copied to sheet 2 A1. If the space on sheet 1 has a 2 it will be copied to sheet2 to A1 and A2. Please tell me there is a way to do this easily! I trust you Excel Gurus! 1 James 2 Steve This then becomes James Steve SteveSolved282Views0likes8CommentsSetting Default Worksheet using Office Scripts
I'm working on an office script for Excel that generates the file as I want it, but for some reason, the file automatically opens up to the last sheet in the lineup instead of the first. I've tried a few methods like .activate() but they don't seem to work; only opening the file manually, switching to the first sheet, and saving does. Switching sheets also doesn't show up in when recording actions. Is there a command or method to make sure the file automatically opens up to the first sheet after my script is done setting up the document?117Views0likes2Comments