I'm not an excel whiz but really stuck on this one and hoping a guru out there will be able to help me out as it's really important for some research I am doing - please!! I think it will be quite a simple fix (see attached example excel sheet for context below). If you are even able to modify the formula in question and re-attach that would be awesome too!!
There are 2 datasets in sheet 1 side-by-side. The data on left (rows A to K) displays data in 10 sec time epochs, the data on right (rows N to X) in 1 min time epochs. I would like to be able to drag the formula in P2 all the way down the column P based on data in column C (as per colour coding in red and blue).
You'll note that the P2 formula is taking a SUM of C2-C7 and P3 is taking sum of C8-C13. I would like to be able to continue this pattern down the column, perhaps with a better drag-down formula (or more efficiently – as there is loads of data!) if possible. Essentially I want each single data row on the right to move onto the next block of 6 rows from data on the left.
I hope I explained that well enough. Really hoping someone can help! Really important to me!
Patrick
See attached excel example - thanks so much!! I will be ever grateful!
https://www.dropbox.com/s/72r7ty9v15vzyyv/drag%20formula%20quick%20way%20-%20help.xlsx?dl=0
Here's one way. In P2 enter:
=SUM(OFFSET(INDEX(C:C,(ROWS($A$1:$A1)-1)*6+2),0,0,6))
and then copy that across and down as required. This is volatile due to the use of OFFSET which shouldn't be a problem with a small data set like this, but if your real data is bigger and you have more formulas, you may prefer:
=SUM(INDEX(C:C,(ROWS($A$1:$A1)-1)*6+2):INDEX(C:C,(ROWS($A$1:$A1)-1)*6+7))
which is only semi-volatile. (i.e. it will recalculate whenever the workbook is opened, even if its inputs haven't changed)
Related
I am a programmer, so please bear with me. I understand that Excel isn't necessarily what I am used to in other domains, but I'm cracking my head open on how to accomplish something that seems somewhat simple.
I have a column of numbers that are themselves the basis of a formula. I want to filter those cells based on some criteria and pass them to another function to perform a calculation.
I understand that this can be done with "filters" in the excel sense. This would mean I would have to click multiple times for each calculation, filter the results, copy the value and paste it where I need it to be. If the data ever changes, I will have to do it all again.
What I am looking for is the equivalent of filtering in a programming language, here's an example:
let range = [1,2,3,4,0,-1,-2,-3,-4];
let subrange = range.filter(function (cell) { return cell > 0; });
subtotal(1,subrange);
So what my excel is like.
I have a column G, that has 12,000+ results in it, each one of these columns is like this:
=(En-Bn)/Bn
These are copied down, n means the row number from 5-12,000+
Now I would like to create a cell, M2 such that it contains:
=SUBTOTAL(1,[ Gn in G5:G12000 where Gn > 0 ])
The goal is that I do not want to have to point and click, because actually, there are many more cells I need to create (about 20) with similar kinds of "filter" predicates.
It would be nice, as much as possible, if I also don't have to specify the n...n-1 range of the column, as ideally that can change. Could be 10, could be 20,000, shouldn't matter.
The best formula or solution would be like:
SUBTOTAL(1, [ Gn in G0:GLENGTH where Gn > SOMECELL ])
Any pointers, or suggestions where to read, or a solution would be awesome. I've been searching on google, and it seems that I lack the right understanding to find the answer in the material presented.
Also, please excuse me for using programmer speak, I know that Excel formulas are not necessarily a 1:1, I'm just looking for a way to save time. Answers in VBA or using Macros are welcome, the main thing is to find a way to do it...
Best,
Jason
Update
I should specify that it needs to be a bit backwards compatible, so I can't use the FILTER function that is only available in >= 365
I'm not at all sure that your attempts at saving time by talking in programming language instead of English really saves either time or space. My best effort determines that you got us all confused. Please tell me why the simple formula below doesn't work.
=AVERAGEIF(G2:G15000,">"&A1,G2:G15000)
This formula requires A1 to hold a number and the formula supplies the > sign. A variation would have A1 contain both, number and comparison, like >1.2`
=AVERAGEIF(G2:G15000,A1,G2:G15000)
The above formulas start the range at G2. Change to G5 if that is what you need. G15000 is a random number intended to be larger than anything you will ever need. The function ignores blanks. However, if you are worried about having a sheet with 16000 rows just on the day you forgot where to adjust the formula I would recommend the use of a named range which you could format to be dynamic.
Named ranges are neater to handle than range addresses and names can be given descriptively, such as HourlyReadings. The above formula would then look like this:-
=AVERAGEIF(HourlyReadings, ">"&A1,HourlyReadings)
Theoretically, the formula by which HourlyReadings is defined could also be written into the worksheet formula but it would become unwieldy. As shown above, you would have to look into the Name Manager to know if the range is dynamic or not but, of course, once defined you can use the same name in many functions and formulas which saves a lot of maintenance time.
This is for Excel 365, using worksheet formulas. With data in column G starting in G5, in another cell enter:
=SUM(FILTER(G:G,G:G>0))
How about an array?
=SUM(IF(G:G>0,G:G,""))
put cursor in 'function bar' with formula. Then press CTRL+SHIFT+ENTER (in that order while holding them all down. {} will appear around formula.
Let me know if further assistance is needed.
Matt
I've found similar examples through searching but I can't find anything that matches the issue that I have...
I have a table which shows parts received/rejected, I wish to see the maximum days early/late (I'll only need help with one as the other I can then do!)
- but there are dummy orders which I wish to ignore (they show a received/reject of 0).
Here is example data from the 'AnnualDump' sheet:
My current calculation is
=IF(ISBLANK(AnnualDump!$H$2),"BLANK",0-MIN(AnnualDump!$G:$G))
[Column H is Received/Rejected and G is VarianceDays]
This simply looks at if there is any data on the sheet before running the calculation, which is fantastic for 95% of the time... but I want to ignore any values that have a received/rejected of 0...
I want it to show 29, but it's showing 30 in this instance as it's not ignoring 0qty lines.
I've tried adding another IF statement but it didn't work :/
Completely stuck now and not sure what the next step to try is...
I can do it if I cheat (call both columns to another sheet, turn text white, use an 'IF cell greater than x, then value' to compare the whole lot and then min/max that third column) but I'm trying to avoid that!
Any pointers or help will be greatly appreciated (complete VBA noob in excel so I'd like to avoid that if possible).
Thanks
Try this array formula. Confirm with Ctrl, Shift and Enter and curly brackets will appear round the formula.
I would strongly suggest you don't use full column references though as these formulae are rather resource-intensive.
=IF(ISBLANK(AnnualDump!$H$2),"BLANK",0-MIN(IF(AnnualDump!$H:$H>0,AnnualDump!$G:$G)))
I need a formula to compare one cell to a range and then depending on where the cell falls into the range, tell me how many more of something I need to get the original cell above the next highest number in the range. The range is only 4 numbers that are fixed.
Below is an image to hopefully help visualize what I want. Where it says "You will need at min x more Power..." is where I need the formula to go. I basically want the 'x' to be a number 1-4 depending on how the Power Pool: Available (W) number falls into the range under 15.4W/Port table in the lower left corner.
So right now you can see that I have 3 Switches and the Power Pool Available is only at 1275W. Looking at the table in the bottom left corner you can see that with 3 Switches that number needs to be at least 2328.48W.
Hope I've given enough info and I apologize if there is already an answer somewhere. Thanks in advance!
*Updated with Row and Column identifiers
*Update:
I know what I want in my head, I'm just having a hard time getting it out my fingertips!
Basically I want cell C24 to tell me how many more power supplies i need(either 0,1,2,3, or 4) based on where cell K21 falls into the range E28:E31.
I'm thinking what I might actually need is for line 24 to tell me how many more watts I need vs how many more power supplies. Because in real life, there are a few options of power supplies available.
I've tried a few IF statements but if I change it to how many more watts I need I might actually be able to figure it out.
So with that, since I'm currently using 3 Switches and according to my table at the bottom I would need 2328.48W of power to supply 15.4W of power to each port. Cell K21 is only at 1275W so I want cell C24 to tell me that I need 1053.48 more Watts of Power, at min.
Hope this helps! Thanks again!
Morning, I am working to review/analyze a set of lab data. It has up to 95 samples, so I am looking to automate as much as I can, but I am at a wall with this one.
Each sample has three columns; a concentration, a qualifier (which may be blank, u, or j), and a MDL. Currently the data starts in column AC, with 3 columns per sample, but for a variable number of samples. My goal right now is to count the number of samples that have a "u" in the qualifier column AND have an MDL that is not equal to their concentration. (I tried pasting in a table, but I couldn't get it to work so apologies).
I am currently using a simple sum of COUNTIFS statements "=SUM(COUNTIFS(AD5,"U",AC5,"<>"&AE5)+COUNTIFS(AG5,"U",AF5,"<>"&AH5)...", however I have to update the cells referenced manually which is a bit time intensive and can introduce errors. Does anyone know how I might use an offset formula or something? I figure that is my best bet since the data is uniformly setup. I just can't get it right on my end.
Many thanks for any help!
A simple solution is to reformat to a single table (probably using VBA for automation?) then create a fourth column with a logical value for the concentration == MDL test. Then use countifs like you proposed.
This can be obviously extended by creating a fifth column with the AND() test and using simple countif.
If you have samples on different columns (I get the impression because of: =SUM(COUNTIFS(AD5,"U",AC5,"<>"&AE5)+COUNTIFS(AG5,"U",AF5,"<>"&AH5)...",
and you really want to use offset, you can create a "sample count" cell for each table (located at row 1+ the maximum sample size you have in the whole book) and then use offset and countifs like you wrote. References should update automatically when copying.
If I understand correctly, you could use countifs straight up if the references are set up correctly and copy the cell, pasting it at the location I said before
(1+ the maximum sample size you have in the whole book)
First of all, I am not VBA user.
And I have written a very complex Excel worksheet internally correlated with functions.
Let's say x as the value that I type in and y as some numbers I am trying to get eventually as a result of calculations.
So what I am trying to do is changing x values while saving previous y values.
It would nice if I could have y values in different cells depending on x values.
For example, if x is 3, y returns in cell B1, and if x is 4 y returns in cell B2.
It would be appreciated if anyone could suggest an idea for this problem.
I have to be honest and say that based on the limited information in your question, this is the sort of thing that VBA makes easier. With VBA, you have far more control over how output from calculations are displayed, so 'recording' results in a formated (historical) fashion is much easier.
Consider a typical Excel Based Invoice system (I'm talking about freebies to download). You have a worksheet that looks like an invoice - it has boxes for text, lines for items, quantity, cost. It totals it all up at the bottom (all using formulas). You can manually print the invoice and that's fine. But you want to record the data to view again later? Rather than 'copy' the worksheet, most of the examples you'll find have a button (with VBA code), to store just the data (without the 'invoice' formatting) on a separate sheet.
Whilst you said that you're not a VBA person, you haven't specifically said that the solution must be a formula. Therefore, I have to say that in my opinion, the solution is definitely VBA and that's where you should be looking. Happy to create some example code to point you in the right direction if you agree.