Suppose I have a simple spreadsheet with 3 rows of data that I want to rank in separate columns. The example I will use is simple, but my actual dataset is 12k + rows. In this simple example, I want to use the RANK formula from Excel to do this. To rank the values in column Police, I'll use the formula =RANK(B2, B2:B11, 1), with B2:B11 being the range.
As I mentioned, my actual dataset has thousands of rows and many more columns to compare. Even in this example, I want a simple way to copy the formula to all of the other _RANK column cells. If I simply copy the cell to the other cells, +1 gets added to the cell value. This is what I want to happen, EXCEPT for the ending cell of the range.
As you can see above, this is incorrect. The formula gets set to =RANK(B11,B11:B20,1) for cell E11, when what I want is =RANK(B11,B11:B11,1). How can I easily copy this formula across multiple cells so that it is has the correct formula?
Placing $ before the cell references makes it static. Try changing your formula to Rank(B11, B$2:B$20,1). Coping this formula will only change those references which are not proceeded with $.
Related
In my worksheet in column F I have a list of names, that may appear or disappear according to other inputs in the spreadsheet. I want the cells in the columns G:AZ to remain blank if the corresponding cell (i.e. same row) in column F is also blank. Because I have thousands of cells to which I need to apply this, I'm using Pullover's Macro Creator to add this small change to all the formulas inside the cells really quickly, so I can do entire columns in seconds. In column J, for example, I've been applying this formula:
=IF(COUNTBLANK(INDIRECT("RC[-4]",0))=1,"",[this part changes and doesn't matter])
You can see that I need to change that "-4" to different numbers according to the column I'm working on. But I have so many columns that it's still going to be a pain to change that hundreds of times.
My question: Is there a formula I can use in the COUNTBLANK function that can reference the corresponding cell in column F without needing any changes in different columns and different rows? And since the INDIRECT formula is so volatile (I still don't know what that means, but I guess it's bad), is there a solution that doesn't use this formula?
enter image description hereI need to make an auto-fill of values from adjacent cells in table to another non adjacent cells of another table, for example, I need to get the following:
Source values: C7,C8,C9 ...
Destination: G4, G7, G10 ...
Thanx
I'm curious about your use case for this. I also have questions:
Are the source and destination always ordered? Meaning the names appear in the same order in both? Are these both on the same sheet as in your example? Are there always 3 cells per name in the destination?
I can't think of a formula that would give the desired result, but here's an approach I would take.
Make sure your source values and destination are on separate sheets.
Create a helper column in your source value range numbering your rows of data 1...x
Copy cells 1...X and paste them directly below you last row of data two times. So you should see 1...X repeat twice.
Sort your helped column least to greatest - you should now have two empty rows between each row of data.
Copy the column of data you need and paste into your destination. Because of the empty rows it should preserve your spacing.
You can achieve this with VLOOKUP. Use this formula in the Destination table.
=VLOOKUP(G3,Source,2,FALSE)
G3 is the cell in which the name, e.g. "Mike", is written. In your sample this appears to be a merged cell. Note that in merged areas all cell content is always in the first cell. So, if G3:G5 are merged, nothing can be retrieved from G4 or G5 because all content is in G3.
Source is a named range of 3 rows and 2 columns, as per your example. If your source is a true table you can use its name. VLOOKUP requires that the name must be in the first column of the range you specify. You can also specify a hard range, if you don't like using names. In my example the Source range was $A$4:$B$6.
2 is the column in Source from which to return the result.
False specifies that you don't want an approximate match (but an exact one).
Of course, this method works in the direction opposite to your diagram. The formula is in H3 in my test sheet. This is because there are no formulas in Excel that write to cells they don't themselves occupy.
I'm searching for a way to link the range of an Excel table to a specific number.
Let's say I have a table that has a range of A1:B10. I want to make the number '10' dynamic and link it to a number that is calculated from another sheet. Let's say cell F1 contains that number and the value is '20'.
Is it possible to make a dynamic range so the table range changes to: A1:B(F1). Then my table would adapt automatically and this has to work in my file.
I prefer a formula instead of a macro in VBA, because I normally don't work with VBA.
An alternative is to use a dynamic named range which is what we used to do before tables. The range, enclosed by marching ants below, is defined as follows:
=OFFSET(Sheet3!$A$1,0,0,Sheet3!$F$1,5)
The top left cell is A1. It is as many rows deep as the number in F1 and 5 columns wide (which could also be made dynamic).
Yes, INDIRECT is your way to make any formula dynamic / dependent on other cell values.
Say you want to sum range A2:C2. But the value 2 for C is located in Cell G2.
=SUM(INDIRECT("A2"&":C"&G2))
this is equal to write =SUM(A2:C2) in my example below.
If you set G2 to 3 it would calculate A2:C3 for this =SUM(INDIRECT("A2"&":C"&G2)).
If you mean Excel table, I guess the answer is no with formula, probably with VBA.
So I have tried to use sumproduct to pull data from cells. My issue is that I would prefer to pick 5 individual cells vs a bank of cells.
I can make this formula below work, but it pulls "Place" cell values into the equation as well as "Points" value cells
Image of cells and formula
I would like to use the formula
=SUMPRODUCT(Large(C5,G5,K5,O5,S5,W5,AA5,{1,2,3,4,5))
to pull only from the 7 specific cells, but I get an error. as soon as I enter large, it only has the first 3 cells highlighted.
The error states that You've entered too many arguments for this function.
I am new to the Large formula as well, but it can only accept an array, not individual cells. You did specify individual cells which would lead to the next argument.
Since the Large formula only excepts 2 arguments you have too many and it fails with an error.
It is not a nice solution, but I guess the formula could work if you put your specific individual cells in neighbouring cells to create the array needed for the formula. (Or at least refer to them in some other cells to create the Array)
For the result you also would need 5 cells to enter the Sumproduct formula to display in each cell the 5 individual results.
Similar to:
=SUMPRODUCT(Large(A1:A7,1))
Where A1:A7 would be the newly created array where you reference:
in Cell A1 =C5
in Cell A2 = G5
in Cell A3 = K5
etc.
The LARGE function expects a single contiguous range as its first argument.
This array formula should circumvent that restriction.
=SUM(LARGE(IF(MOD(COLUMN(C:AA), 4)=3, C5:AA5), ROW($1:$5)))
I am attempting to use an IF statement to check whether the sum of two cells from another Excel sheet is greater than or equal to 1.
For a sheet called Test1 with the values of interest in column C, this is what I have so far, which works fine:
=IF((Test1!C1+Test1!C2>=1),1,0)
In column B on a second sheet that I'll call Test2, I want to copy this formula down 200,000 rows. However, if the aforementioned formula is in cell B1, for the formula in B2 I would like the formula to read:
=IF((Test1!C3+Test1!C4>=1),1,0)
I want to copy the formula down the column so that the second cell reference in the formula in the first row does not become the first cell reference in the formula in the second row (eg. it would go C1+C2, then C3+C4, C5+C6, etc.).
I have tried manually entering the formula for a few rows, highlighting those, and copying them down but can't get the desired cell reference pattern. If I highlight and drag these first three formulae down another three rows, C4 and C5 are repeated and not in the correct pair.
=IF((Test1!C1+Test1!C2>=1),1,0)
=IF((Test1!C3+Test1!C4>=1),1,0)
=IF((Test1!C5+Test1!C6>=1),1,0)
=IF((Test1!C4+Test1!C5>=1),1,0)
=IF((Test1!C6+Test1!C7>=1),1,0)
=IF((Test1!C8+Test1!C9>=1),1,0)
I have tried using OFFSET() within this formula but couldn't get it to work. I am basically just wanting to add 1 to each of the cell references in the formula, as compared to the previous row (but not to actually add 1 to the value of that cell, as would happen with C1+1 for example).
Any insight would be greatly appreciated!
If you plan on copying this down 200K rows then you will want the absolute simplest formula that accomplishes the stagger. Avoid the volatile OFFSET function or be prepared to spend a lot of time waiting for random calculation cycles to complete. A volatile function will recalculate whenever anything in the workbook changes; not just when something changes that involved the formula in the cell.
=--(SUM(INDEX(Test1!C:C, (ROW(1:1)-1)*2+1), INDEX(Test1!C:C, (ROW(1:1)-1)*2+2))>=1)
The following formula should do the trick:
=(SUM(INDIRECT("C"&ROW()*2-1);INDIRECT("C"&ROW()*2))>=1)*1
And that's the version using IF:
=IF(SUM(INDIRECT("C"&ZEILE()*2-1);INDIRECT("C"&ROW()*2))>=1;1;0)
You say I am basically just wanting to add '1' to each of the cell references in the formula but appear to be incrementing by 2, so I am confused but an option might be to apply you existing formula to 400,000 rows, together with =ISODD(ROW()) in another column, then filter on that other column to select and delete those showing FALSE.
Excel's autofill won't do the 2-cell shift that you're looking for. You can use the functionality that is there.
Put =IF((Test1!C1+Test1!C2>=1),1,0) in the top cell and drag a copy to the second row (it will be =IF((Test1!C2+Test1!C3>=1),1,0) but that's okay). Now, put 'A' and 'B' in the next column. Select all 4 cells and copy them down 400k rows.
Use filter to delete rows flagged with 'B' and delete the blank rows.
(Select blank rows with [F5] click Special and select Blanks, then right-click and delete)
Here is all you need. It's fast and nonvolatile.
=--(SUM(INDEX(Test1!C:C,ROW(1:1)*2-2):INDEX(Test1!C:C,ROW(2:2)*2-2))>=1)
Copy it down as far as you like.