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.
Related
My intention is to lookup value in Date column in sheet 1, find matching date column in Sheet 2 then copy the date from Sheet 2 to Sheet 1.
Formula I am Using is --
=VLOOKUP(A2,2!A2:C3,1,FALSE)
but the result errors out in N?A value. Not sure what am I doing wrong?
1
+--------+--------+
| Date | Value |
+--------+--------+
|28/02/18| |
+--------+--------+
2
+--------+--------+---------------+
| Value | % |Date |
+--------+--------+---------------+
| 1000000| 20 | 28/02/18 |
+--------+--------+---------------+
| 2000000| 10 | 31/01/18 |
+--------+--------+---------------+
| 3000000| 30 | 29/12/17 |
+--------+--------+---------------+
VLOOKUP requires that the lookup column be on the left. Use INDEX/MATCH
=INDEX(2!A:A,MATCH(A2,2!C:C,0))
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))
What I'm trying to do is a little complex but I think it's doable in Excel.
I have two worksheets in a workbook on sheet one I have this...
| Code1 | Code2 | Code3 | Code4 |
| BA1 | xxxxx | xxxxx | |
| BA2 | xxxxx | xxxxx | |
| BA3 | xxxxx | xxxxx | |
And on the second sheet...
| CodeA | CodeB | CodeC | CodeD |
| BA1 | 1 | date | text |
| BA3 | 1 | date | text |
| BA1 | 2 | date | text |
| BA2 | 1 | date | text |
| BA1 | 3 | date | text |
| BA3 | 2 | date | text |
| BA2 | 2 | date | text |
What I want to do is lookup Code1 on sheet one and find it in the second sheet in CodeA then find the highest CodeB for CodeA and then concatenate CodeC and CodeD and place them on Sheet one in Code4.
I hope that makes sense, Thanks for any advice.
I think I understand. Does this look correct?
Sorry for the swedish formulas but it's an array formula that you add with CTRL+SHIFT+ENTER.
The formula in english is:
{=MAX(IF(Data=A2,CodeB;-1))}
And the named range Data is Column H and I, and CodeB is Column I.
If it does not find the value it returns -1
Sorry noticed now that I only did half of the job.
Make another named range called Table that spans column I to K (Code B -> Code D).
And in column code3 add this formula:
=Vlookup(B2,Table,2,false)
And in code4:
=Vlookup(B2,Table,3,false)
And you should get:
This should find the results you are looking for.
This is an array formula so you will need to press CTRL+SHIFT+ENTER once you have entered it into the formula bar, this will have to done for every formula you add to the column.
As it is an array formula I have only written it to reference rows 1 to 18, you will need to update all references to include you last row.
Columns titled CODE1(to 4) are on the first sheet (Sheet 1)
Columns titled CODEA(to D) are on the Second sheet (Sheet 2)
=CONCATENATE(VLOOKUP(CONCATENATE(A2,MAX(IF(Sheet2!A:A=A2,Sheet2!B:B,-1))), CHOOSE({1,2},Sheet2!A1:A18 & Sheet2!B1:B18, Sheet2!C1:C18 ),2,0)," ",VLOOKUP(CONCATENATE(A2,MAX(IF(Sheet2!A:A=A2,Sheet2!B:B,-1))), CHOOSE({1,2},Sheet2!A1:A18 & Sheet2!B1:B18, Sheet2!D1:D18 ),2,0))
If you do not require a space between the dates, just remove " ", from the middle of the formula.
I'm searching for a certain formula in Google Sheets. Let me explain the situation. I have a Google Sheets with multiple tabs. The values and strings within one of these tabs is changing each hour and the order is never the same.
So want is to search for a certain string in the tab that always changes. When that string is found, I would like to have the value of the cell on the right of that string.
The formulia would be something like this i guess: "tab,search of string,cell on the right"
Thanks,
Remy
Alternatively,
This may also work (even for plural matches):
=concatenate(ArrayFormula(if(Sheet2!A:Z="String", offset(Sheet2!A:Z, 0, 1)&" ",)))
where Sheet2 is the tab that is searched and
"String" is the search string.
The following will work if there is one and only one match. It's not case sensitive.
Assume that the tab to search is Sheet1. In another sheet add the following
Cell A1 : String to search
Cell A2 : Add the following formula
=ArrayFormula(
INDIRECT("Sheet1!"&
TRIM(
JOIN("",
QUERY(
IF(ISERROR(SEARCH(A1,Sheet1!A1:C2)),
,
ADDRESS(ROW(Sheet1!A1:C2),COLUMN(Sheet1!A1:C2)+1)
),
,
1E+100
)
)
)
)
)
Note: I only did the following tests:
Sheet1
+---+---+---+---+
| | A | B | C |
+---+---+---+---+
| 1 | A | B | C |
| 2 | D | E | F |
+---+---+---+---+
Sheet2: Test 1
+---+------+
| | A |
+---+------+
| 1 | E |
| 2 | F |
+---+------+
Sheet2 : Test 2
+---+------+
| | A |
+---+------+
| 1 | a |
| 2 | B |
+---+------+
Note: If you require to make the above formula case sensitive, replace SEARCH by FIND.
I have a table being created via an XML map so it has a lot of blank cells in each column. It looks like:
| Name | Stat 1 | Stat 2 | Stat 3|
| Test | | | |
| | Four | | |
| | | 5 | |
| | | | 102 |
Basically each row has only one value and I am trying to transpose it onto another worksheet where all the values are one row like this:
| Name | Stat 1 | Stat 2 | Stat 3 |
| Test | Four | 5 | 102 |
In my searching I found this formula:
=IFERROR(INDEX(Table9[#name],SMALL(IF(Table9[#name]<>"",ROW(Table9[#name])-ROW(Table9[#name])+1),ROWS(A2))),"")
I set that and in A1 of another sheet and drag it down and it does return the populated cells but it is also returning 0 for all the blank cells instead of skipping them until it has a value to return.
There may be a better way to do this so I am open to other options but would prefer to avoid vba if possible.
Thanks.
Let's say input sheet is called Sheet1 and the Name is in cell A1 on both sheets. Then use following formula for Name on output sheet:
=INDEX(Sheet1!A:A,(ROW()-2)*4+2)
and for Stat 1:
=INDEX(Sheet1!B:B,(ROW()-2)*4+3)
and so on ... more generally:
=INDEX(
input_column_range,
(ROW()-first_row_in_output)*number_of_columns + first_row_in_input+column_index
)