I'm certain it must be possible but I can't find the way to do this.
I have 2 columns, one with numbers and a second column with dates.
for example:
number date
1 21-Jul
2 22-Jul
3 23-Jul
4 24-Jul
5 25-Jul
6 26-Jul
7 27-Jul
8 28-Jul
9 29-Jul
10 30-Jul
At the top I have 2 cells
one where I want to enter the relevant number and one where the connected date should be displayed.
Say the cell with 1 is cell B10 and the first date is C10
If I enter 1 in the cell above the other cell shoould display the date from C10
If I enter 7 in one cell the other should display the date from C16.
How do I use the number entered in one cell to point at another cell?
I tried things like
A1 - cell with the number
B1 - =C(9+A1)
but it isn't that simple.
It's frustrating how something that seems so simple is impossible for me to figure out.
I look forward to your replies.
I think you need the function VLOOKUP. Specifically, in cell B1 enter:
=VLOOKUP(A1,$b$10:$C$20,2,false)
Where
A1 is the input cell,
B10:C20 is the range containing your numbers/dates
2 tells EXCEl to lookup the value in the second column
FALSE is a setting that forcesw Excel to find an exact match
You could also try the index-match function combination.
=INDEX ( Column I want a return value from , ( MATCH ( My Lookup Value , Column I want to Lookup against , 0 ))
Rather than give you a brief but possibly inadequate explanation, I'll give you a link to a thorough summary of how Index-match works:
http://www.randomwok.com/excel/how-to-use-index-match/
Related
In column D (Result), I would like to have the following formula.
For each Cell in column C, find in column B the first value higher than the value of the cell of column C (starting from the same row) and gives as output the difference between the values found in column A (Count).
Example:
the value in C2 is 40. the first cell of B that has a value higher than 40 is B6. So D2 takes A6.value - A2.value = 5 - 1 = 4.
Can it be done without the use of VBA?
It can easily be accomplished with an array formula (so you have to enter the formula with Ctrl+Shift+Enter ) :
{=MATCH(TRUE;IF(B2:$B$7>C2;TRUE;FALSE);0)-1}
Put this formula in cell D2, and just drag down. You only have to change the end of your data set (change $B$7 into the real last cell of the column with data)
The formula works as follows :
The IF statement results in an array with TRUE/FALSE values that meet your criteria : {FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}
The MATCH (with the 0 switch) searches the array for the index of the first match, which is 5 in our case
And you have to subtract 1 to get the offset to the cell where the function is placed, so this gives you 4
So although you have to enter it as an array formula (you will get an N/A error without the ctrl+shift+enter), the result is just a single number.
Also, depending on your data set, you might want to add some ERROR handling in case no match has been found, e.g. just using the example data set in your question, the result in cell D5 will be N/A so you have to decide what value you want the result to be in such case.
And finally, I did not use the values in column A, as I assumed this is just a sequential ascending counter. If this is not the case, and you specifically want to find the difference between the corresponding values in that column, you can use the variant mentioned by Foxfire... in one of the other answers: =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2
A slightly adjusted and shortened answer on Peter K.'s suggestion:
In D2:
=MATCH(TRUE,$B3:B$7>C2,0)
enter the formula with ctrl+shift+enter
Something like this should work for you. First transform your range to a table.
=IFERROR(AGGREGATE(15,6,--([#Second]<[First])*(ROW([#Second])<=ROW([First]))/--([#Second]<[First]*(ROW([#Second])<=ROW([First])))*[Count],1) - [#Count],"")
In this formula the comparison between [second] and [First] starts at the same row. That means that the value in D5 is 0 and not 1. (Like #Foxfire And Burns And Burnslike stated in the comments).
Ok, I did not post the answer waiting until OP answered why D5 is 1 instead of 0, but my formula is also an array formula. It would be:
=MIN(IF(B2:$B$6>C2;A2:$A$6))-A2
To type this formula in array mode, you need to type it as usual, but instead of pressing ENTER, you need to press CTRL+SHIFT+ENTER
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 have a sheet in Excel where the columns contain different names of people that are in different teams in my department (i.e. Names in Column 1 are in Team 1).
For another sheet, I need to have a formula that achieves the following:If I write a name in Cell B2 that can be found in the first column of that other sheet (Team 1), Excel should populate cell B6 with "Team 1".
If instead, the name I wrote is found in the second column, then the text should read "Team 2".
I've tried a couple of different formulas w/o success, and stringing a lot of IF and OR functions together is way too cumbersome. Anybody has a better solution?
If you need this formula for more then only two column then id use the formula
=INDEX(Sheet1!C1:G1,SUMPRODUCT((Sheet1!C2:G6=B1)*COLUMN(Sheet1!C2:G6)))
Say you have a set-up like:
And in B1 of Sheet2 you enter Name3, you want it to return TEAM1 as shown below:
The only catch to this formula is that you will need to tell it how many columns are before your data so if you have a table more like:
Then you need to tell the formula that there are 2 rows before your data starts, your new formula will be
=INDEX(Sheet1!C1:G1,SUMPRODUCT((Sheet1!C2:G6=B1)*COLUMN(Sheet1!C2:G6))-2)
Notice the -2 before the last parenthesis this is to indicate that there are 2 columns BEFORE you data.
and the new result for looking up say NAME20 would become as follows:
*EXPLANATION: *
The formula works as follows , I will do it all on one page for easier viewing and instead of Sheet2!B2 and B6 I will use G2, and G6 on the same sheet as the data.
First we look at all values in the Range A1:E6 and find the one with the matching name so we use
=A1:E6=G2
Now when you enter this into the cell you will recieve a #VALUE,but if you goto the Formula Bar and press F9 it will shwo you the full value of the formula
{FALSE,FALSE,FALSE,FALSE,FALSE;FALSE,FALSE,FALSE,FALSE,FALSE;FALSE,FALSE,FALSE,FALSE,FALSE;FALSE,FALSE,TRUE,FALSE,FALSE;FALSE,FALSE,FALSE,FALSE,FALSE;FALSE,FALSE,FALSE,FALSE,FALSE}
In this we know that one cell contains the Name we searched for, this is represented by the TRUE
Now when using a formula like SUMPRODUCT, FALSE = 0 and TRUE = 1
So to get the column we mutiply every result by the column they are in.
=SUMPRODUCT((A1:E6=G2)*COLUMN(A1:E6))
So any cells that don't =G2 are FAlSE or 0, and when you multiply the column of that cell by 0 (because false = 0) it will simply result in 0. But for the one cell that IS TRUE or 1 When you multiply the column of that cell by 1 (because TRUE = 1) The product will be the cells column number
So as shown in the picture when looking for NAME13 the result of the sumproduct is 3 (its column)
Then to return the TEAM for that name, we use the INDEX function will return the value in a cell at the given cordinates.
In this case we want the value from A1:E1 that is in the same column as the Name we matched. When looked at as an Array A1:E1 looks like
{"TEAM1","TEAM2","TEAM3","TEAM4","TEAM5"}
And we want to return the value in that array at the same position as the column number of our cell, Minus any nonincluded column before the data, thus the reason for the -2 in the secon example I gave you.
So:
=INDEX(A1:E1,SUMPRODUCT((A1:E6=G2)*COLUMN(A1:E6)))
In this example excel interprets this formula as
Return the 3rd value (the 3 comes from the sumproduct as explained earlier) in the list of value from A1:E1. And that value would be TEAM3.
use a MATCH() or VLOOKUP() function inside an IF(). SOmthing like:
IF(NOT(ISERROR(MATCH(...)));"Team1";"")
Did you know you can browse functions by catergoty (such as Search), just clikc the fx left of your formula bar and use the drop down box. Each formula comes with a description with usually rather clear information...
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.
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.