| ID | Email | Username
1| 1 test#email.com Test
2| 2 123#test.com ABC
3| 3 bca#123.com 123
The table above is titled Table3
I need to get the value for the specific column (which is specified in cell A1 on the nth line).
So for example here is a work sheet
| A |
----------------
1| Email
2| =Index(Table3[A1], 1, 0)
3|
This should return test#email.com
However, Table3[A1] is looking for a column titled A1 rather than Email
Please try:
=INDEX(INDIRECT("Table3["&A1&"]"), 1, 0)
Related
I would like to know if it is possible to apply the WorksheetFunction on a range instantly.
For example, say I want to Vlookup with the Index 1 & 3 to get their ID Num
|Index|Name|Sales|ID Num|
|-|-|-|-|-|
|1| A| 2| 123|
|2| B| 3| 321|
|3| A| 5| 456|
|4| A| 1| 654|
I managed to achive it on the vlookup function:
Range("J2:J3")=WorksheetFunction.VLookup(Range("I2:I3"), Range("A:D"), 4, 0)
Where :
"I2:I3" are the cells storing the criteria 1 & 3
"A:D" is the column Index, Name, Sales & ID Num
The excel formula version is "=VLOOKUP(I2,A:D,4,0)"
It returned me :
cell "J2" = 123
cell "J3" = 456
,which is good but when I use the same methodology on the SUMIF function, it gives me a run-time error Type mismatch
Here is the code : Range("G2:G3") = Application.WorksheetFunction.SumIf(Range("B:B"), Range("F2:F3"), Range("C:C"))
Where :
"B:B" is the column Name
"F2:F3" are the cells storing A & B
"C:C" is the column Sales
The excel formula version is "=SUMIF(B:B;F2;C:C)"
In the formula above, I want to get the total sales for A & B
Have I done something wrong?Or is there an alternative?
Please let me know
Thanks in advance
I've seen some similar questions for this, however none were suited correctly.
I'm wondering if I can return a row cell based on the max value in the same row, but different cell.
So I have this;
| A | B | Date
1| X | 2 | 01/01/17
2| Y | 3 | 17/01/17
3| Z | 4 | 18/01/17
4| X | 2 | 21/01/17
5| Y | 3 | 03/02/17
6| Z | 4 | 03/02/17
7| Z | 4 | 07/03/17
8| Z | 4 | 09/03/17
9| Y | 3 | 13/03/17
So Column A displays a string, and Column B counts how many times that Column A string is repeated. I have another sheet with a row for each month, being 01, 02, 03, 04, etc. I am trying to get the string from Column A, which the highest value in Column B, grouped by each month. So for the above example, the next sheet would look as so;
| A | B
1| X | 2
2| Draw | 1
3| Z | 2
I have been able to achieve the date grouping aspect for similar functions using;
IFS(E:E,D:D,">=" & DATE(A$2,B6,1),D:D,"<=" & DATE(A$2,B6,EOMONTH(B6,0)))
If anyone has any ideas on how I could achieve this, it would be much appreciated!
Edit;
I've managed to figure parts of it out, I have been able to get the most common name (without checking for multiples) using
=OFFSET(A1,MATCH(MAX(Count),Count,0),0)
Now I just need a way to merge that formula with this one;
=IF(AND(Dates >= DATE(2017,9,1), Dates <= DATE(2017,9,EOMONTH(9,0))),)
How do I pass the results of the =IF to the =OFFSET?
I have a reference table that looks something like:
__ A______ | B____| C____| D____
1| Job Type | Hours | Fee 1 | Fee 2
2| Review_ | _2___ | $10__ | $15
3| Review_ | _4___ | $15__ | $15
4| Test____ | _2___ | $20__ | $10
5| Test____ | _4___ | $30__ | $10
6| Repair__ | _8___ | $60__ | $15
7| Repair__ | _16__ | $100_ | $20
I would like to be able to create price sheets by entering a job type and a number of hours, and have Excel automatically add up the appropriate amounts from columns C and D. For example, if I select "Review" and "4" for the hours, it would return $30.00, if I select "Test" and "4" for the hours it would return $40.
The following formula in an existing template:
=SUM(IF(X1=(A2:A7),IF(X2=(B2:B7),(C2:C7)+(D2:D7),0),0))
works, but if I highlight the cell with this formula and push "Enter" I get #VALUE and if I copy the formula to another worksheet it always returns 0. I feel like a VLOOKUP is probably needed but not sure how to implement it into a compound IF formula within a SUM.
Add two SUMIFS:
=SUM(SUMIFS(C:C,A:A,X1,B:B,X2),SUMIFS(D:D,A:A,X1,B:B,X2))
I have the following basic table:
1|
2| Title....
3|
4|
5| | Row Index | Type | Etc... |
6| | 1 | abc | ..... |
7| | 2 | def | ..... |
8| | 3 | ghi | ..... |
9| | 4 | jkl | ..... |
Note that the table does not start on Excel row 1. Technically ROW()-5 would work, but I do not want to hardcode the actual row the table starts on.
My formula for Row Index is:
=ROW()-CELL("row")+1
This works fine, except for when you edit another cell in the table. It seems that the formula assumes the row you edit is index 0 and starts the row count from there.
For instance, if I were to edit a cell in row 3 in the above table, the Row Index values would look like this:
| Row Index | Type | Etc... |
| -1 | abc | ..... |
| 0 | def | ..... |
| 1 | ghi | ..... |
| 2 | jkl | ..... |
After each edit, I think have to re-edit a cell in the top row to get the Row Index values correct again.
Is there a reliable way to display row numbers in a table?
If it is an actual Excel Table (Insert tab > Table or Home tab > Format as Table):
=ROW()-ROW([#Headers])
or
=ROW()-ROW(Table1)+1
Otherwise, you can use the absolute address:
=ROW()-ROW($5:$5)
Remove the CELL("row") and just use the formula
=ROW() - 5
The ROW function returns the row number of the cell containing the formula, which is what you want.
The CELL function, on the other hand, returns information about the last changed cell, which is why you see the strange behavior.
CELL(info_type, [reference])
Reference Optional. The cell that you want information about. If omitted, the information specified in the Info_type argument is returned for the last cell that was changed. ...
Even if CELL returns information about the current cell, what you would get from ROW() - CELL("Row", <current_cell>) + 1 would be the constant 1 because the two functions cancel each other.
I have a set of data which look like this:
A B C
1| Date | Value | Sum
2| 2014/08/03 10
3| 2014/08/02 7
4| 2014/08/01 5 todo
5| 2014/07/03 6
6| 2014/07/02 2
7| 2014/07/01 6 todo
8| 2014/06/03 1
9| 2014/06/02 4
10|2014/06/01 3 todo
Each cell on the Sum column has this part of code (will be autocompleted by dragging it down): IF(MONTH($A2)=MONTH($A3);"";"todo")
This would result in displaying text at each month's last line. The "todo" part would be replaced with code, which counts all values within the same month of "each last line", what would be the best way to do that?
In C2 enter:
=IF(MONTH(A2)=MONTH(A3),"",SUM($B$1:B2)-SUM($C$1:C1))
and copy down
For your example: