|
If you want more control over which rows in one range match to rows (or columns) in another, generally you use the INDEX function. The ROW function will give you your current row number and to compress 10 rows into one just divide by 10 and take the FLOOR or CEILING. Adding and subtracting before the division and after the ceiling allows you to offset the rows in the source and target ranges. In this case using ceiling is easier than floor because it will map 1 - 10 > 1 rather than 0 - 9 > 0 and is generally easier to reason about.code:
|
# ¿ Dec 30, 2018 05:13 |
|
|
# ¿ May 3, 2024 06:40 |
|
If you aren't exactly sure how the formula works, you can use the Evaluate formula tool under Formulas > Formula Auditing to see it broken down step by step. You understood correctly what I meant by header rows. If the first row of actual data in the export sheet is row 20 then you would want ROW()-19, as ROW()-19 = 1. If the data in the 'Master List' sheet starts at row 10 then the index range should be 'Master List'!$A10$A$.... So the final formula would be =INDEX('Master List'!$A$10:$A$1000,CEILING((ROW()-19)/10,1)). This will then get the customer name from row 10 in the master list for export rows 20 - 29, 11 > 30 - 39, etc. If you are getting different results from auto filling up vs down then there is definitely an error. The formula should be identical in each row so make sure that you are using an absolute range that doesn't change as you copy it. The other common source of error is changing the first row but forgetting to update the rest and then copying them as a block to end up with a different formula every 10 rows. This can be hidden in this scenario because it might take a few customers before the error grows large enough for the result to be wrong.
|
# ¿ Dec 31, 2018 05:26 |
|
Here is a function:code:
|
# ¿ Mar 24, 2019 07:24 |
|
I don't understand why you need an array formula. Can't you just put your formula in cell B2, point it at A2 and copy it down as many rows as you need? You can pass a custom sort order to the sort function using this notation {1;5;2;...} =IF(ISBLANK(A2),"",TRANSPOSE(SORT(IMPORTXML("http://www.omdbapi.com/?t=" & A2 & "&r=xml&apikey=29e7c8aa","//@plot|//@director|//@writer|//@genre|//@actors|//@rated|//@imdbID|//@country|//@year"),{5;8;2;4;7;1;6;3;9},true))) I added a sheet to that link with how it could work.
|
# ¿ Jan 6, 2020 04:58 |
|
To do it with standard formulas this is how I would approach it, the padded general comments may be duplicates though but this could be solved using a similar method to the task comments, i.e. ranking and picking top n.code:
|
# ¿ Mar 28, 2020 07:16 |
|
Does something like: =OFFSET(Table1[#Headers],0,3,1,COLUMNS(Table1[#Headers])-3) do what you need? I think you'll need to use a named range to use it in a dropdown though.
|
# ¿ Dec 19, 2020 19:57 |
|
I know this is an old question, but here is an answer anyway. You can use something like this (assuming a recent version of excel): =TEXTJOIN(", ",TRUE,REPT($A$2:$A$16,ISNUMBER(SEARCH(" "&D2&","," "&$B$2:$B$16&",")))) Where $A$2:$A$16 are the category labels, $B$2:$B$16 are the number collections, and D2 is the number you are searching for.
|
# ¿ Apr 25, 2021 12:17 |
|
You basically had it. The only things that needed changing are your if statements need an end if when they are more than one line and you need to wrap the formula for c2 in double inverted commas, e.g. r.offset(0,2) = "=B2+15" You say you want this to work for any new row though, so if you change A to be Range("A:A") then when any cell in column A is edited columns b and c will be automatically filled. I have made the column C value generic so it should just work. code:
|
# ¿ May 19, 2021 18:46 |
|
Using this formula in your conditional formatting will work: =AND($A2=$D$2,$B2=$E$2)
|
# ¿ Jul 22, 2021 11:52 |
|
I would start with something like =left(b2, len(b2)/4) If the data is more complicated than that I would find the point where the first line is repeated again (i.e. a new line followed by the first line of text) and extract the lines before that. =LEFT(B2, FIND(CHAR(10)&LEFT(B2,FIND(CHAR(10),B2)),B2)-1) Also it's ctrl+J not alt+J for a new line character, so that may have been the issue.
|
# ¿ Oct 14, 2022 03:59 |
|
With the various updates and suggestions, I'm not sure what your code looks like now, but this code should work, just update the const strings as required. Also make sure that the cell is not being updated when the pivot table changes size when the filter updates. I suggest for this function, if an error is thrown then the best thing to do is just quit. This could be because the sheet / table / field doesn't exist in which case you need to fix your code, or the user has entered an invalid value. If the user enters something invalid then the function will clear the filter but not be able to set it again. Depending on your users and use case this might be fine or you might want to add something to let them know. Visual Basic .NET code:
|
# ¿ Nov 18, 2022 10:37 |
|
Searching for that error message seems to indicate that Excel can't find the field you are looking for in the pivot table. Check to make sure your the pivotFilterFieldName is correct, I think it should be something like this based on your previous post.Visual Basic .NET code:
|
# ¿ Nov 18, 2022 23:55 |
|
I understand this can be frustrating and not a worthwhile time investment, but given the error you had: "Unable to get the PivotFields property of the PivotTable class" you are very close to a working solution and it's probably something really simple like a trailing space or something similar. You can check for trailing spaces, etc., with a formula in your spreadsheet e.g. =""""&A2&"""" (cell reference based on your earlier screen clip, it should point to the filter name cell in your pivot table) and then copy and pasting the field name wrapped in double inverted commas into your vba as the pivotFilterFieldName. Alternatively, if you run the PrintPivotFields macro below (in the vba editor, click the green arrow, hit F5, or Run > Run, and then select the PrintPivotFields macro) and it will print out all the pivot table filter fields in the current file to the vba immediate window (View > Immediate Window), formatted so you can copy and paste the correct set of lines straight into the original function (also included for reference). If you try these solutions and still have no success then, while I'm still happy to help, I understand if you don't want to spend any more time on it. Visual Basic .NET code:
|
# ¿ Nov 25, 2022 12:54 |
|
Use an XLOOKUP, assuming your table is from a1 to f5 the formula would be: =XLOOKUP(A2,$C$1:$F$1,C2:F2,B2,0,1) which matches the estimated grade against the column headers and returns the ungraded column if it's not found.
|
# ¿ Jan 5, 2023 14:04 |
|
Trivia posted:I hope what I've written makes sense. If any of you can tell me how to do it better or just point me in the right direction code-wise I'm sure I will eventually figure it out. A couple of suggestions:
Given your template, this is how I would approach it. I would define an array that contains the areas I am interested in for each boat. This gives you flexibility if you have boats with different numbers of engines or items, or you just want to change the sheet formatting. Then when a cell is updated, check to see if it's a current date cell for one of the boats and update that boat by reading and then writing all of its values at once. JavaScript code:
|
# ¿ Feb 19, 2023 07:39 |
|
HootTheOwl posted:I think you deleted the parenthesis around your method calls in the bottom block. AG3 posted:I have a slightly modified piece of VBA code I got from google that I've been using for one of my Excel sheets at work, but for some reason I can't get it to work on the Excel version on my other PC. It goes like this: Given you mention changing locale settings, if your language is not English then you may need to change Visual Basic .NET code:
|
# ¿ Nov 15, 2023 00:39 |
|
Ideal Paradigm posted:Is there a way to filter a set of values from one sheet and apply it to two other sheets in the same workbook? I've assumed that there are 3 sheets each with a table, i.e. Sheet1 > Table1, Sheet2 > Table2, Sheet3 > Table3, and each table has a column named ID. Firstly, you want to be able to catch an event that fires when the source table's (Sheet3) filter updates. Excel doesn't have a built in event for this, so create a new sheet (Sheet4) that has a single formula in it =SUBTOTAL(2,Table3[ID]) . When Sheet3's table is filtered this formula gets recalculated. This allows us to use Sheet4's Worksheet_Calculate() method to handle the filter update. You can hide this sheet after setting it up. The rest is just getting the filtered ids from Sheet3 and applying them to sheets 1 & 2. In the vba editor add this code to the Sheet4 object, and update the constant values to suit your object names: Visual Basic .NET code:
|
# ¿ Nov 23, 2023 06:44 |
|
HootTheOwl posted:That's not vb.net code! But it does have pretty colours . We need to go on strike until vba code styling is added.
|
# ¿ Nov 23, 2023 12:05 |
|
HootTheOwl posted:So the ID numbers do match just some of them don't have a mate in the other sheet? This is how I interpreted the question. I also thought that the Sheet3 values would have their own filter applied and updated, hence the VBA solution. Ideal Paradigm: if you don't need to filter Sheet3 then go with someone else's solution. It's also worth noting that my solution will need to be tweaked slightly to work on mac. Ideal Paradigm posted:Apologies, I'm not familiar with the VB code. Should I look this up on YouTube on how to input this? To add the code: Open the VBA editor using the Alt + F11 shortcut, or via the ribbon in the developer tab > Visual Basic. The developer tab is hidden by default, so you may need to show it by: right clicking the ribbon in an empty space, selecting customise the ribbon, and checking developer in the right hand panel. In the VBA editor in the left hand side project panel there will be a project that correlates with your workbook with a number of objects nested under it, one for each sheet and another for the workbook as a whole. The code I posted needs to go inside the Sheet4 object (assuming that is the new sheet with the subtotal formula), so double click the object and paste in the code in the main window. The code will run whenever Sheet4 is recalculated, so assuming you have added the formula to Sheet4 as previously mentioned, updating the filter on Sheet3 will run the code and filter sheets 1 and 2.
|
# ¿ Nov 24, 2023 03:05 |
|
|
# ¿ May 3, 2024 06:40 |
|
It's probably easiest to use a regular expression replace. You'll need to add a reference to 'Microsoft VBScript Regular Expressions 5.5' in the vba editor menu Tools > References.Visual Basic .NET code:
|
# ¿ Apr 10, 2024 09:29 |