office scripts
500 TopicsGetting data from Snowflake to Excel
Hello I have multiple no technical users and am trying to find a way to setup a snowflake query for them and then let them refresh it whenever they want or on a schedule, but I couldn't find a good solution this what i found so far: ODBC (Not great for non technical users needs setup on each user desktop) Power Automate (Needs Power Automate Premium which we don't have) Third Party tools (Expensive pricing models) Through Power BI (We want to separate this process from power bi) Any suggested solution please!Solved111Views0likes3CommentsSeries fill a formula down a column automatically skipping a set number of rows
I am trying to fill a formula down a column every 6th row but incrementing the variable in the formula ($A2) for each entry. The formula uses the Take command and inputs 5 rows of data, so to keep it from "spilling" I need the formula to increment every 6 rows, having one blank row between each section. I have been able to accomplish "copying" it each 6th row with VBA #1 and filling the series with VBA #2 but can't figure out how to combine the two. Any help would be appreciated. VBA #1: Sub FillEvery6thCell() Dim ws As Worksheet Dim startRow As Long, lastRow As Long, col As String Dim formulaText As String Dim r As Long ' Set your sheet and parameters Set ws = ThisWorkbook.Sheets("Top 5 Employees") col = "A" ' Column to fill startRow = 10 ' First row to start filling lastRow = 60000 ' Last row to fill ' Get the formula from the starting cell formulaText = ws.Range(col & startRow).Formula ' Fill every 6th cell For r = startRow + 6 To lastRow Step 6 ws.Range(col & r).Formula = formulaText Next r Range("A2:A60000" & iRow).Replace What:="@", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2 MsgBox "Formula copied to every 6th cell in column " & col End Sub VBA #2 Sub FillFormulasDown() Dim sourceCell As Range Dim fillRange As Range ' Define the cell containing the formula Set sourceCell = Range("A2") ' Define the target range Set fillRange = Range("A2:A5000") ' Fill formulas down sourceCell.AutoFill Destination:=fillRange, Type:=xlFillSeries End Sub179Views0likes6CommentsOffice Script - Bug in .map()?
Hi, I'm pretty sure this is a bug, but maybe I'm doing something silly when constructing the formula? I'm trying to set formulas down a column in a table, from an array called test1. The test1 array is created using .map() from an original array (file_names) that uses .getTexts from another column in the same table. The dimensions of target_range (another column in the same table) match those of test1 array. The test1 array is appropriately 2D (i.e. [[formula1],[formula2]...[formulaN]]. The test1 array is correct when inspected in console.log() (in all cases, including when an equals sign is used.....explained more below). The problem is that trying to use .setFormulas, is only using the first value from test1 for every cell in target_range, not each respective element from test1. After a massively frustrating amount of time, I've traced the problem solely to this (as far as I can tell): The presence of an equals sign in the .map() when using string interpolation to create the formula. This code correctly writes the text of the formula into each cell of target_range, using each respective value from write_array with appropriate interpolation: let file_names: string[][] = rng_file_names.getTexts(); let test1: string[][] = file_names.map( row => [`\"${row}\"&\"TestString\"`] ); target_range.setFormulas(test1); If you try to do exactly the same, but try turning it into a formula by including the equals sign at the start of the interpolated string inside the array returned by the .map(), it will only write the first value of test1 into all cells of target_range: let file_names: string[][] = rng_file_names.getTexts(); let test1: string[][] = file_names.map( row => [`=\"${row}\"&\"TestString\"`] ); target_range.setFormulas(test1); I'm pretty sure this is a bug, but if someone can point if I'm doing something stupid, it would be appreciated!59Views0likes1CommentFilling a column with succeeding lists
Hi, I need a list of files, with numbers starting from 001 for each box. Adding the number for one box is easy but I have thousands of them. A box number is like "0001AA0001". The first number and the letters never change, so I have : 0001AA0001 0001AA0002 0001AA0003 Then I have to add the files numbers, like "0001AA0001/001". I already have a line for each file, but only with the box number in the forst column, repeated several times, each time for every file. What I have What I need 0001AA0001 0001AA0001/001 0001AA0001 0001AA0001/002 0001AA0001 0001AA0001/003 0001AA0002 0001AA0002/001 0001AA0002 0001AA0002/002 0001AA0003 0001AA0003/001 0001AA0004 0001AA0004/001 0001AA0004 0001AA0004/002 0001AA0004 0001AA0004/003 Can you please tell me how can I add automatically the /001 and so on without having to do it for each box ? I can't manage to use a model for CTRL+E and I'm not accustomed to use the functions. Thanks, M.T.162Views0likes3CommentsTokyo Stock Exchange data
Does any one know, and can share, a sample excel file that can import updated information (ticker, name, last price, dividend yield, daily high and daily low and analysts average target price) for ~50 stocks traded on the Tokyo stock exchange, which is not covered by Microsoft?458Views0likes3CommentsHelp needed with IF and COUNTIFS Formulas
Is anyone able to advise the following formula: =COUNTIFS($B$5:$B$15,$R$4,$C5:$C15,"<=" & V3,$D5:$D15, ">" & V3)-COUNTIFS($B$5:$B$15,"="&$R$4,$G5:$G15,"<=" & V3,$H5:$H15, ">" & V3)-COUNTIFS($B$5:$B$15,"="&$R$4,$K5:$K15,"<=" & V3,$L5:$L15, ">" & V3)-COUNTIFS($B$5:$B$15,"="&$R$4,$O5:$O15,"<=" & V3,$P5:$P15, ">" & V3) Is there a way to simplify this? Is there a way to make this more accurate? Cells in column G & H, I & J, O & P are using the following format: =IF(C6="","",C6+E6) Cells in U4:CC4 are using the following format: =COUNTIFS($B$5:$B$15,$R$4,$C5:$C15,"<=" & U3,$D5:$D15, ">" & U3)-COUNTIFS($B$5:$B$15,"="&$R$4,$G5:$G15,"<=" & U3,$H5:$H15, ">" & U3)-COUNTIFS($B$5:$B$15,"="&$R$4,$K5:$K15,"<=" & U3,$L5:$L15, ">" & U3)-COUNTIFS($B$5:$B$15,"="&$R$4,$O5:$O15,"<=" & U3,$P5:$P15, ">" & U3) Cells in U5:CC15 are using the following format: =IF(U$4>=$T5,1,"") My issue is is when I put in the three break times, the mid break comes out at a shorter time. My other issue is is that when I put in the times in row 5,6and 11, the data is coming up as a combined data in rows 5, 6 and seven on the page two. Just for reference, "page two" is the same spreadsheet. What I need to happen is that I enter in the shift start time and finish time. This then populates through to Break 1, 2 and 3. The Time entry is the time the break starts. ie: 1 hour after start of shift, 1 hour after coming back from break, etc. The break entry is the duration of the break taken. ie: 30 minutes. Once all the info is put in, the relevant "Time Block" on "Page 2" shows a 1. What is happening at the moment is that when I enter all the time data, the time blocks are not populating correctly in accordance to the entry. Basically, If I have numerous people on shiftI need the time blocks to show where I have shortfalls in shift cover and not having too many people on break at the same time. IE: Link to Live Copy: https://www.dropbox.com/scl/fi/eur1j526htu1j8a4d4290/Staff-Breaks.xlsx?rlkey=r4tm9xts4tonofpa2th2cusfw&st=nueyk0d7&dl=0 Any ideas would be greatly appreciated.269Views0likes4Comments