Dog Cat Bird Gary
A 0 C 100%
B 0 B
C ok D 100%
D ok 100%
E no A
F ok F 100%
Is it possible to reference the 1st 2nd or 3rd column by column number/position instead of column header? So instead of
Table1[#Dog]
It would look more like this.
Table1[#(1st column)]
In VBA it is.
ListObjects("Table1").ListColumns(1)
But I need to know if there is a formula way to do this?
Also Just to make clear I DO NOT want to know what column number or letter it is in the worksheet. I want to reference the 1st column by position within the table, NOT header name. TY
If you want to refer to cells in the same row as your formula, which is what it looks like from your question, you can use INDEX.
Above, the formula =INDEX(Table2[#],2) refers to the second column in the same row as your formula.
If you don't want to refer to the row the formula is in, just refer to the whole table and INDEX on the row and column. For example, this refers to the fourth row in the second column:
=INDEX(Table2,4,2)
Note that Table2 refers to the data area of the table - not the headers - just like a database table.
Offset formula.
If Dog is in A1 and you want BIRD in C1 then you would use this formula
=Offset(A1,0,2,1,1)
=Offset(Refecence Cell, X, Y, B, D)
Offset starts a range, down X rows and over Y columns from the reference cell (first tow numbers) and returns a range the size of the second two numbers of B rows and D columns.
Here is a link to a description of the OFFSET function
Related
I need to compare the B2 Cell value (6012469) with Column A i.e. cell A2 to A10 and return the b2 cell value (6012469) in column C where the value matches i.e. cell C5,C7, C9 AND C10 and NA in remaining cells where the value is not matched.
I have around 15000 rows of data is column A and need to automate the process.
I have attached the sample image for reference.
[1]: https://i.stack.imgur.com/DvzC3.png
Select any cell inside your data range in Column A. Go to your ribbon, click Home > Format as Table. It doesn't matter what colour scheme you choose.
Make sure that all your data in Col A plus Cols B & C are included in the table.
Then, in any cell of your table in Col C (e.g. in C2), paste this formula:
=IF(ISNUMBER(SEARCH($B$2,[#[Column A]])),$B$2,"")
Excel should automatically populate all of your Col C in the table with this formula. (If it doesn't, then you should see a little clickable prompt next to the cell asking if you want to overwrite all the other Col C cells with this formula.)
The table with the Col C formulas would look something like this:
Note: Of course, you could achieve something very similar without using a structured table, but not as conveniently as this because you would have to copy the formulas down to the other approx. 15000 rows. Even the Fill Down feature is not as convenient.
ADDITIONAL: a different formula in response to the asker's request that each cell in Column C match any of multiple values in Column B --
=IFERROR(INDEX($B$2:$B$4,MATCH(TRUE,ISNUMBER(SEARCH($B$2:$B$4,A2)),0)),"")
NOTE: if more than one Column B value matches a Column A cell, Column C will display Column B's topmost match
I tried a lot to find a solution for the below issue, lets say I have column A,C,D ; I want to take the fist value in column A and check if it exist in C or D entire columns; if exist then I will return A, then take the second value in A and search in C & D columns and so on.
The bottom line, is that I want to find the count of each value in column A that existed in C or D
Thanks
=COUNTIF(C:C,A1:A4)+COUNTIF(D:D,A1:A4)
Using SUMPRODUCT Function
Formula used in cell B2
=SUMPRODUCT((A2=$C$2:$C$7)+(A2=$D$2:$D$7))
And Fill Down!
I need to compare the date of a cell against a column that has multiple date and I see which one it matches and get the associated value. Here I put an image to explain myself better:
Column D is where I need to put the formula, which compares the dates in column A on sheet 1 with the dates in column A on sheet 2. If it matches, I need to multiply the values in column C on sheet 1 by the values in column B of sheet 2.
Here another image with an example to be clearer
I have a little idea that would be something like:
= YES (ERROR (MATCH (Sheet1! A4; Sheet2! A2: A32; 0)); Sheet1! C4 * X
In the x it should go B3, but I don't know how to get that cell in the search above.
Try this:
=VLOOKUP(A3,sheet2!A:B,2)*C3
I have recreated your spreadsheets below.
i need a formula to reference 3 different rows, depending on which column i paste into.
What i know is
the width is constant, 34 columns across
i want to paste into columns A1, L1, W1
I want to retrieve the values for cells, AK1,AK2,AK3
im using this at the moment to grab parts of the text in that cell. eg
="<tag" &MID($AK3,FIND(" ",$AK3),FIND(" ",$AK3,FIND("1",$AK3))-FIND(" ",$AK3))&" endtext>"
my idea was when i paste into column 22 i need something to return the number 2, pass that to an offset formula on AK1, as this is 2 thirds the way across, then i can reference 2 rows down from AK1 and get the value.
Hope that makes sense.
Here is an example. Cells A1 C1 E1 are retrieved from the H column
Presume you have named the three values sitting in Column AK as Rng_AK,
when you paste this formula =INDEX(Rng_AK,ROUNDUP(COLUMN()/34*ROWS(Rng_AK),0))
anywhere between Column A to K, you will get the first value in the given range;
anywhere between Column L to V, you will get the second value in the given range;
anywhere between Column W to AH, you will get the third value in the given range;
I am using your logic of locating the value in Column AK by the relative position of the column in the 34-Columns range.
See below screen-shot for more clarifications. Cheers :)
I have two tables of data, call them table 1 and 2. In table 1 there is a long list of reference numbers. Each reference number has its own cell.
In table 2 I have the exact same reference numbers; however, in table 2 these reference numbers may or may not share that cell with another reference number. See below. The bottom three reference numbers in table 1 all share the same cell and are separated by a comma always.
Imagine table 1 and 2 are on separate tabs of the same workbook.
table 1 and 2
On the work sheet for table 1, I am trying to bring back the month found adjacent to the reference number in table 2. I am trying to take the value in table 1, search it in table 2, and return the month so that I get this result:
result in column b of table 1
I would like to avoid delimiting the values in the shared cells of table 2.
Thanks in advance for your help!
If your reference number are unique, you can get by with doing a wildcard vlookup
Assume you have a range in columns F and G where your reference numbers and months are. In Range A:B you want the values.
Essentially you are looking up like this.
If my value A1 is in column F and it matches a substring get the value from G
So you would use this formula in B1
=VLOOKUP(CONCATENATE("*", A1, "*"),$F$1:$G$6,2, FALSE)
what this is doing is, get the value from A1, and match the range of F:G where the first column CONTAINS A1, get the value from the corresponding G column
From there copy paste the formula for the rest of the
cells in B column