I have two sheets on my xls-document. I want to add conditional formatting to my second sheet. The conditional formatting should be depending on the frist sheet. But there is no fix cell i can reference. The cell which should be referenced in my formular should depend on a value which can be entered by the user.
First sheet:
The row A functions like an index. The rows D, E and F could be filled with anything. But they can also be empty.
Second sheet:
The row A tells me ony which row from the first sheet my conditional formatting should refer. The rows B, C and D should be formatted like this:
If the column D with the index 1 of my first sheet has a value, all rows on my second sheet with the index 1 should color red if the column A is empty. If the column D with the index 1 of my first shett has no value, all rows on my second sheet with the index 1 should color red if the column A is not empty.
I know how to reference cells from another sheet and how to color the cell red. But i dont know how to make it depend on the index (column A).
VB is not allowed. Only conditional formatting. Can you guys help me?
I was able to solve my problem with the VLOOKUP-function.
VLOOKUP(A4;Firstsheet!$A$4:$F$14704;4;FALSE)
This looksup the given area on my first sheet (second parameter) and searches for the index (first parameter). When the index is found, it returns the fourth column of the found row (thrid parameter). I dont know what the fourth parameter does.
This just returns the value from the indexed cell from my first sheet. I was able to use this to solve my problem.
Her is the whole formular for Secondsheet.B4:
=AND(NOT(ISEMPTY(A4));OR(AND(NOT(ISEMPTY(B4));ISEMPTY(VLOOKUP(A4;Firstsheet!$A$4:$F$14704;4;FALSE)));AND(ISEMPTY(B4);NOT(ISEMPTY(VLOOKUP(A4;Firstsheet!$A$4:$F$14704;4;FALSE))))))
Related
I have an excel workbook with two worksheets.
On one sheet I have data horizontal and my second sheet I have data vertical.
I want on sheet 2 to drag down my reference from sheet 1 data.
I am looking to have column increase not my row increase? Makes sense?
I try to "equal" the cell i want from sheet 1. However when I drag down my reference goes down instead of across.
Any help would be appreciated.
Conceptually: Use Index. The syntax is Index(range,row number, column number)
If you want to transpose a range in Sheet1 to Sheet2, you can use
=Index(Sheet1!$A$1:$J$10,column(A1),row(A1))
Copy across and down.
See how the row argument uses the column command and the column argument uses the row command. That means in the starting cell A1, the INDEX formula will return the column number 1 for the row argument and the row 1 for the column argument, i.e.
=Index(Sheet1!$A$1:$J$10,1,1)
Copy the formula to row 2 and the reference in the column argument will refer to Row(A2), so the formula will translate to
=Index(Sheet1!$A$1:$J$10,1,2)
i.e. it will return the value from the second COLUMN of the index range. See the screenshot for a result. Change the Index range to your desired source.
I am using 2 spreadsheets. Sheet1 -Return Codes needs the values from Sheet 2- GL Interfaces. I am trying to match with column 1 on sheet 1 to sheet 2 in order to bring back the correct Name associated with an application ID.
The formula displays in the cell instead of the value replacing the formula:
=VLOOKUP(A2,'GL Interfaces'!A2:F61,2,False). What is wrong with my formula for this simple lookup?
I click in the column where I want the value to return to.
Click Formula | select Vlookup.
Click on A2 (the column with the application numbers) on sheet 1
Go to second sheet and highlight array that I want to be searched.
Put in 2 as a column with the Names (col index num) that I want to be searched on the second sheet
Enter False for the last entry (Range_Lookup)
Enter and only the formal displays in the cell I want a Name to appear.
What am I doing wrong?
=VLOOKUP(A2, 'GL Interfaces'!A2:F61, 2, false)
is a valid formula. make sure that the first column of the 2nd argument of vlookup is the one that contains the value from the first argument of vlookup. in other words: A2 needs to be found in A column of sheet GL Interfaces and if there is a row with a match, then return value from B column of GL Interfaces sheet
I have a worksheet where I need to fill in data referenced from other worksheets.
I need to match a value on my main sheet with one on another sheet and once the cell has been found I need to get the value of a different cell offset by 1 row up and 5 columns left. I know which columns I need but I need MATCH to return the initial row.
MATCH will give me the initial row that I need.
ADDRESS means I can build the cell reference.
OFFSET allows me to reference another cell if I have the original cell address.
However the ADDRESS function will only return the address as a text string and not as a reference that can be used in the OFFSET formula.
Does anyone know of a way to make this work?
Kind regards
Matt
If the value on your main sheet is in cell Sheet1!A1, and the matching value is somewhere in column Sheet2!J:J.
The MATCH formula will return the row number:
=MATCH($A$1,Sheet2!$J:$J,0)
You want one row up from this so the formula will be:
=MATCH($A$1,Sheet2!$J:$J,0)-1
Make sure this does not fall below 1
To return a reference to another cell you'd use INDEX as this is non-volatile and won't try and recalculate unless you change a figure it uses.
It returns a reference to a cell given a range of cells, a row number and a column number.
Your column is always five columns to the left, so if you're matching in column J you want a figure from column E.
e.g. If you want row 5 from column E you'd use =INDEX($E:$E,5).
Replace the row number with your Match formula and you get the figure you're after:
=INDEX($E:$E,MATCH($A$1,Sheet2!$J:$J,0)-1)
Hopefully this will stop the chain.
See the linked questions if you want more background, but I need to conditional format multiple rows (2,000+) from the FIRST (leftmost) non-blank cell + the next 11 columns after it. Not sure if it's needed for the conditional format formula, but I am able to get the start cell for each row, can kind of get the end cell (see below).
Cell address of the first populated cell in the row (*the data starts on row 2, the values begin in column C and end in column P):
{=(ADDRESS(2,COLUMN(INDEX(C2:P2,MATCH(1,IF(C2:P2<>0,IF(C2:P2<>"",1)),0)))))}
^ this gets me an absoluted text-version of the leftmost populated cell in each row. I have all these addresses in a helper column. I am then able to get the desired stopping-point for the format (12th cell to the right of the cell returned from above formula), but I have to manually enter the cell address derived from above formula:
=ADDRESS(2,COLUMN(OFFSET(N2,0,11,1,1)))
I can't nest the start cell formula inside this second formula or it breaks.
THANK YOU!
Desired result (ignore the different colors, they can be the same):
I added a helper column C that finds the first non blank in the row (my data went from column D to column AZ)
=MATCH(TRUE,INDEX((D2:AZ2<>0),0),0)
My conditional format rule applied to D2 to AZ4 was to highlight when the following was true:
==AND(COLUMN(D2)<($C2+11+COLUMN($D2)),COLUMN(D2)>=$C2+COLUMN($C2))
You can modify this to put the helper column where you wish, and to use named ranges.
(Had to add condition to not start coloring before the first instance!)
My question is how can I find an intersecting cell of a specific column and row number?
My situation is this: with some calculations I find two cells, lets say B6 and E1. I know that I need a row of the first one and a column of the second one. So I could just use ROW and COLUMN functions to get the numbers. After that, I need to find an intersecting cell. Which would be E6 in this example.
I would just use INDEX(A1:Z100;ROW;COLUMN) but I don't know the exact area that I'm going to need - it depends on other stuff. I could use something like A1:XFG65000 but that is way too lame. I could also use a combination of INDIRECT(ADDRESS()) but I'm pulling data from a closed workbook so INDIRECT will not work.
If this would help to know what is this all for - here's a concrete example:
I need to find limits of a section of a sheet that I would work with. I know that it starts from the column B and goes all the way down to the last non-empty cell in this column. This range ends with a last column that has any value in first row. So to define it - I need to find the intersection of this last column and the last row with values in B column.
I use this array formula to find the last column:
INDEX(1:1;MAX((1:1<>"")*(COLUMN(1:1))))
And this array formula to find the last row:
INDEX(B:B;MAX((B:B<>"")*(ROW(B:B)))
Last column results in E1 and last row results in B6. Now I need to define my range as B1:E6, how can I get E6 out of this all to put into the resulting formula? I've been thinking for a while now and not being and Excel expert - I couldn't come up with anything. So any help would really be appreciated. Thanks!
You can use an Index/Match combination and use the Match to find the relevant cell. Use one Match() for the row and one Match() for the column.
The index/match function to find the last cell in a sheet where
column B is the leftmost table column
row 1 is the topmost table row
data in column B and in row 1 can be a mix of text and numbers
there can be empty cells in column B and row 1
the last populated cell in column B marks the last row of the table
the last populated cell in row 1 marks the last column of the table
With these premises, the following will return correct results, used in a Sum() with A1 as the starting cell and Index to return the lower right cell of the range:
=SUM(A1:INDEX(1:1048576,MAX(IFERROR(MATCH(99^99,B:B,1),0),IFERROR(MATCH("zzzz",B:B,1),0)),MAX(IFERROR(MATCH(99^99,1:1,1),0),IFERROR(MATCH("zzzz",1:1,1),0))))
Since you seem to be on a system with the semicolon as the list delimiter, here is the formula with semicolons:
=SUM(A1:INDEX(1:1048576;MAX(IFERROR(MATCH(99^99;B:B;1);0);IFERROR(MATCH("zzzz";B:B;1);0));MAX(IFERROR(MATCH(99^99;1:1;1);0);IFERROR(MATCH("zzzz";1:1;1);0))))
Offset would seem to be the way to go
=OFFSET($A$1,ROW(CELL1)-1,COLUMN(CELL2)-1)
(The -1 is needed because we already have 1 column and 1 row in A1)
in your example, =OFFSET($A$1,ROW(B6)-1,COLUMN(E1)-1) would give the value in E6
There is also ADDRESSS if you want the location: =ADDRESS(ROW(B6),COLUMN(E1)) gives the answer $E$6
The following webpage has a much easier solution, and it seems to work.
https://trumpexcel.com/intersect-operator-in-excel/
For example, in a cell, type simply: =C:C 6:6. Be sure to include one space between the column designation and the row designation. The result in your cell will be the value of cell C6. Of course, you can use more limited ranges, such as =C2:C13 B5:D5 (as shown on the webpage).
As I was searching for the answer to the same basic question, it astounded me that there is no INTERSECT worksheet function in Excel. There is an INTERSECT feature in VBA (I think), but not a worksheet function.
Anyway, the simple spacing method shown above seems to work, at least in straightforward cases.