I have an Excel Spreadsheet (technically it is a Google Docs sheet, but the functions are pretty much identical.. )
Now in one Sheet, I have a list of cells.
A2 - K2. Each one of these has a number (1-10). This will be called the Index
Beneath those, each cell has a value, so..
A3 - K3. Each one also has a number (a value. Not 1-10, but arbitrary). This is called the Value.
Now then, in another Sheet, I need to be able to type in a Number that will corrospond to the A2-K2 Index and get the Summation of all values up to and including that Index. So then, assume the following...
A B C D
1 1 2 3 4
2 2 4 6 10
If I put in 3 in one cell, then beneath it, I want to get the value SUM(2+4+6). So the cell would show 12. I am having a lot of trouble figuring out how to do this without just outright hard-coding every single one in. Can anyone help me out?
In Excel you could use this formula:
=SUMIF(A1:J1;"<="&L2;A2:J2)
Where L2 is the cell where you will type in the index number.
Related
looking for some help speeding up sorting pages on a spreadsheet.
Currently we have 4 sheets absolutely packed with UK postcodes/zip codes.
At the moment we go into each sheet and sort the entire sheet to show the information for the specific postcode we enter. (Always returns one line of info each sheet)
Is it possible to just have a separate sheet where we enter the postcode it it finds the match from each sheet and displays 1 line from all 4 sheets? Hopefully that makes sense.
A idiot's guide tutorial would be great
So, let's say we have four sheets (sheet1, sheet2, sheet3 and sheet4). They all look like this:
Create your 5th sheet. Here, I'm calling it "lookup_here". You should look up how to use vlookup formulas as I'll fail to completely explain it here for lack of time. Basically, you are :
Looking up a value (such as 5F3322 postal code) in a table array
(such as sheet1 columns A, B, C and D.... keeping in mind that your
lookup value must be in the first column of the array)
Then returning the column index (like column B is 2, column C is 3, etc).
And finally stating if you want an exact match (false) or approximate
match (true). Almost always use false.
Here is what the final output would look like, and I'll put some sample formulas below the picture.
So, you'll input your postal code value in cell B1. Then you will have formulas in B3 through D6. It will take some time to build these.
B3 Formula: =VLOOKUP($B$1,Sheet1!$A:$D,2,FALSE)
B4 Formula: =VLOOKUP($B$1,Sheet2!$A:$D,2,FALSE)
B5 Formula: =VLOOKUP($B$1,Sheet3!$A:$D,2,FALSE)
B6 Formula: =VLOOKUP($B$1,Sheet4!$A:$D,2,FALSE)
Column C formulas are similar, but the 2 before false will be a 3.
Column D formulas are similar, but the 2 before false will be a 4.
Struggling a bit with array formula's to count distinct values in one column, in the rows where two other cells match. Sorry if I can't explain any better. Best is to show you the formula I created and provide some sample data:
Sheet 1
Column A Column B
Period 101 Code X
Period 309 Code Y
Period 101 Code Y
Period 101 Code Z
Period 404 Code Y
Period 101 Code X
Period 101 Code X
Period 404 Code X
Period 404 Code Z
Sheet 2
Column A Column B (where the formula should be)
Code X 2
Code Y 3
Code Z 2
Basically I want to count the distinct values in Sheet 1 column A, only where the value in Sheet 1 column B matches the value in sheet 2 column A. I have provided the expected outcome for the three code values.
I have tried with the following formula, but I am unable to count distinct values in another column where the two cells match:
{=SUM(--(FREQUENCY(IF(C5:C11=G5,MATCH(B5:B11,B5:B11,0)),ROW(B5:B11)-ROW(B5)+1)>0))}
Please ignore the rows and columns used in the formula, also the values in Column A and B on sheet 1 both occur multiple times, but the values in column one on sheet 2 only occur once.
I am curious how someone would solve this one. Thank you in advance.
Caveat: This answer is unlikely to be useful to the OP, as these techniques are as yet only available to Excel Insiders
But once these new features are available to the main stream they will be a game changer.
This uses the new Dynamic Array feature coming to Excel soon.
To create the list of unique values from Column B, place this formula in a single cell. Excel will "Spill" into as many rows as needed to return the unique list of values from Column B. For example, I have used cell E2
=UNIQUE(FILTER($B:$B,$B:$B<>""))
Now, place this formula in a the next adjacent cell, I've used F2
=COUNTA(UNIQUE(FILTER($A:$A,$B:$B=$E$2)))
Again, you only need to put this formula in one cell, no need to copy down. Excel will "Spill" the result into as many cells as needed, to match column E.
Your formula doesn't match your sample data but let's assume the below:
Formula in H5:
=SUM(--(FREQUENCY(IF(C$5:C$13=G5,MATCH(B$5:B$13,B$5:B$13,0)),ROW(B$5:B$13)-ROW(B$5)+1)>0))
Entered as array through CtrlShiftEnter and drag down
Notice the semi-absolute cell references (you used relative ones) + how my ranges are larger than yours (you looked from C5:C11 only)
thank you for taking the time to look at this question.
I'm looking for an equation that can easily take the numerical values from Sheet 1 (the first picture) which has 2 blank cells in between values for four values and then has 4 blank cells and then the other four values. I'm not sure if I am making sense but hopefully the picture I have attached helps.
Notice 2 blank rows between first 4 rows with values (Rows 2-11) and same between rows 16 and 25.
Also notice the 4 blank rows between the two sets of values.
For me, this is repeated for 700 values, same set up of 2 blank rows for 4 sets of values and then 4 blank rows and then four sets of values with 2 blank rows. I'm sure there is an easier way to do this.
I'm trying to recreate Sheet 2 from Sheet 1 using an equation. Is this possible?
Apologies in advance, English isn't my first language.
If the numbers are going to start in B2 and the intervals and offset staggers are static then,
=INDEX(B:B, 2+(ROW(1:1)-1)*3+INT((ROW(1:1)-1)/4)*2)
If the first number is in S6 then,
=INDEX(S:S, 6+(ROW(1:1)-1)*3+INT((ROW(1:1)-1)/4)*2)
Put this in D2:
=IFERROR(INDEX(Sheet1!B:B,AGGREGATE(15,6,ROW(Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A)))/(Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A))<>""),ROW(1:1))),"")
And copy down till you get blanks.
This will return the numbers in order that they appear on sheet 1.
The Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A)) set the data set bounds. This being an array type formula it needs to reference the smallest possible data set. This part finds the last cell in Column A and sets that as the extent of the data set so we do not do unnecessary iterations.
The MATCH part will return the last row that has text in it, if Column A has numbers then we need to change the "ZZZ" to 1E+99 to get the last row in column A with a number.
The AGGREGATE is working like a small in that it will create an array of row numbers and Errors. It will return ROW Numbers where (Sheet1!$B$2:INDEX(Sheet1!B:B,MATCH("ZZZ",Sheet1!A:A))<>"") return true. And an Error where it returns FALSE.
The second criterion 6 in Aggregate tells it to ignore the errors, so it is only looking at the returned row numbers.
The ROW(1:1) is a counter. As the formula is dragged down it will iterate to 2 then 3 and so on. This tells the Aggregate that you want the 1st then the 2nd then the 3rd and so on.
The chosen row number is then passed to the INDEX and the correct value is returned.
If your numbers are in order (smallest to largest like your example) or you want the output in order(smallest to largest) then you can use this simple equation in D2:
=IFERROR(SMALL(Sheet1!B:B,ROW(1:1)),"")
Then copy down till you get blanks.
Here is another formula you might use.
=INDIRECT(ADDRESS((INT((ROW()-ROW($A$2))/4)*14+ROW(A$2))+(MOD(ROW()-ROW($A$2),4)*3),COLUMN($A$2),1,1,"Sheet1"))
You can paste it to the first cell where you want the result and copy down.
Note that $A$2 is the cell from where all the counting starts. If your data start from A3 you can change the references accordingly. Note further that ROW($A$2) is long for 2. I chose this syntax to enable you to identify the meaning.
COLUMN($A$2), on the other hand, just identifies Column A as the source of the data to be lifted. Row 2 in this formula is insignificant. It's the A that counts. However, COLUMN($A$2) is long for just 1, meaning column No. 1, meaning A. Once you get your bearing in the formula you can replace COLUMN($A$2) with 1.
I can't seem to wrap my head around an answer for this. I can find duplicates when using a formula that looks at a single sell and compare it to a range of cells, and copy that formula down every row; afterward I can just sum the results. However, I want a single formula in a single cell.
I want to take a range of cells in one column, compare that entire set to a range of cells in another column, and sum all duplicate cells where the cell in column 1 matches a cell in column 2. For this exercise, all cells in each column are unique within that column, they are only potentially duplicate between columns.
For example:
C1 C2
R1 1 2
R2 2 6
R3 3 7
R4 4 1
R5 5 8
I want a single column sum with a result of 2 (the duplicate cells in C1 is 1 and 2).
This will ultimately be converted into a VBA script however I can work with starting with a single formula. If starting out at VBA is easier then that works for me too.
My specific question is: which functions in excel do I use to accomplish this task?
Thanks for your help.
I believe the formula you want in cell C3 is:
=IF(ISERROR(VLOOKUP(A1,$B$1:$B$5,1,FALSE)),0,1)
This will return a 1 if your column-1 value appears in column 2, and a 0 if it doesn't. Then you can simply copy it down for the extent of your data (changing the referenced range as needed) sum the results of column 3. (Note that the FALSE is important as it forces exact matches; otherwise, Excel will display approximate matches, which will compromise the accuracy of your results.)
I currently have a situation wherein I am required to subtract 2 cells. 1 cell is already known but the second cell is to be found from a range. I have seen this can be done using the SumIf but among the range,criteria,sum_range factor, I dont know how to mention the sum_range as 2 distinct cells.
Also, point to be noted is that these 2 cells needed to be subtracted are in 2 different sheets in the same excel workbook.
I was trying using this below
=sumif(AC1:AC3,Sheet1!AA14,Sheet2!S1 - Sheet1!S14)
But it gives error. Can someone help. Am trying to match Sheet1!AA14 with any one of the values in this range AC1:AC3. And for the a perfect match, it would subtract the corresponding sheets "S" cells
please help
I suggest you try using VLOOKUP if you have the first value of your subtraction equation. Here is an example (sorry I don't understand your setup enough to use your cell numbers):
A B C D
test 20 15 test
test1 10
=VLOOKUP(D1,A1:B2,2) - C1 ' results in 5 (20 - 15)
Look for value in D1
A1:B2 is the range with the value and the data you want back. 1st column is the search column.
If it finds the value it will give back the value in the 2nd column of the range, in this case B.
You then take the value and subtract the value in C1 from it.
Check out MS's documentation on VLOOKUP and mess around with it. Best of luck.