Can i use a variable instead of a row number in Excel - excel

I want to create something similar to a PivotTable where if you type in a cell let's say F1 a value like "5", and another cell that uses that value as a variable let's say F2. F2=A(F1) for example and that should be equal to F2=A5. Is that possible or something similar.
The point of this is to easily fetch data from a row. So if all the data of 1 entity is stored in row 3 and columns A,B,C,D i can easily use that data where i need it by changing the value of a single cell
Example:
Column A is Name, B is Last Name, C is Address, D is City. You have 50 rows of data and another sheet for printing that data. Sheet 2 A1 is used to change a variable so that if i type "3" the cell A2 will show the data from Sheet1A3, A2 will show the data from Sheet1B3 and so on.

In F2:
=INDEX(Sheet1!A:A,A2)
would achieve that.

Related

Building an Excel table based on specific cells from another sheet

I am making a table of averages based on a large table in another sheet.
The original table has 27 samples each with 3 repetitions of "sample name" in column D along with 3 repetitions of "data" in column H through O
ex: Cells D4-6 "22L9" Cells H4-6 "0.21","0.32","0.23"
D7-9 "22p3" H7-9 "0.11","0.42","0.43"
The new table I want to auto-populate column A in the new sheet the first rep. of "sample name" from the original table, in column B an average of the three "data numbers" from H, column C from I, and so forth.
I have tried =AVERAGE('Sample data A'!H4,OFFSET('Sample data A'!H4,3,0))& =AVERAGE('Sample data A'!H7,OFFSET('Sample data A'!H7,3,0)) and filling down but it does not skip cells in the next formulas
I think I understand what you’re trying to do. Even if I haven’t nailed it, I hope this approach gets you started.
Instead of doing the selecting yourself using OFFSET(), let Excel do it for you by using AVERAGEIF(). AVERAGEIF() says “average only those values from column B in rows where column A matches some value.
Let’s say you enter “22L9” in cell A2, “22p3” in cell A3, etc.
Then in cell B2:
=AVERAGEIF(‘Sample data A’!$A$2:$A$50, A2, ‘Sample data A’!$H$2:$H$50)
And then copy that down for how ever many column A values you have. In my formula, I used A2:A50 and H2:H50, I leave it to you to make those ranges match whatever rows contain your data.

Reference data from a range on one sheet to individual cells on another based on neighboring cell value (Excel 365)

Sheet 1 will be references to individuals based on unique identifiers, such that column A will be their name and column B will have the identifier.
Sheet 2 will be an imported list of all individuals in our data set, such that column A is their name and column B is the identifier.
The goal is to be able to fill cells in Sheet 1 Column A based off of values entered in Sheet 1 Column B, by referring to Sheet 2 Column B., i.e. if the column B values match between sheets, I want the neighboring value in Column A to be copied over.
I'm a novice at this, but I don't think CONCATENATE is what I'm looking for, so the closest I've gotten is:
=IF($B:$B=Sheet2!$B:$B,Sheet2!$A:$A)
which results in a SPILL error, because I think my formula is trying to display multiple reference cells of data in one destination cell, whereas a formula such as
=IF(B3=Sheet2!B3, Sheet2!A3)
returns expected results, but is too limited for my purposes, in that it would be potentially faster to just manually enter the data, at that rate.
Trying to simplify, I'll have a sheet that has say 100 people in it, with identifiers 1 through 100. If I punch in their identifier in a separate sheet, I'm looking for their name to be displayed in a neighboring cell, or at least to have their name returned in the same cell, i.e. I enter "90" in Sheet1A1 or Sheet1B1 and it gives me "John Doe" in A1, which is the value of Sheet2B90 that's associated with the number "90" that is in Sheet2A90.
So VLOOKUP does work with some wrangling, but XLOOKUP was the ultimate solution to what I needed. A formula such as
=XLOOKUP(A13,$A$1:$A$10,$B$1:$C$10,NONE)
Would return data from B1 through B10 and C1 through C10 to elsewhere in the sheet, in this case next to a lookup cell A13 into cells B13 and C13, if the value in A13 appears within the lookup array of A1 through A10. Locking the cells with $ allows the formula to be dragged down a range of lookup cells without Excel incrementing the values of the lookup or return arrays, just the value of the lookup cell.

change cell range reference based on other cell value

I have a sheet where I load a set of data in. Each column is a category, but I do not know the specific name/headline/title of each column in advance. I can manually translate the column name to a given category and write that in another sheet. Also, I do not know the number of columns and rows in the data set. See the images for an example where I have a data set and a table where I manually type which column is which category.
The data set:
A table where I manually set which column is which category:
Lets say I now want to use the data associated with a specific category (a column) in a formula such that I take the sum of the column with this category (e.g. "Force" in the example which I have manually stated in the other sheet in cell B2 is column B).
The final result should be that I take the sum of column B (where the column letter is read in the other sheet in cell B2) from row 2 to the end of the column. I believe the two things I do not know to make this work is:
How do I use the value in a cell to refer to a column in another sheet?
How do I take the sum of a column from a known start row to the end (unknown number of rows in the data)?
Any help is much appreciated! :-)
You can use INDIRECT:
=SUM(INDIRECT("'Sheet2'!" & B2 & ":" & B2))
But I would recommend, instead of column letter use the column number A=1,B=2,... and use the non volatile INDEX:
=SUM(INDEX(Sheet2!A:I,0,B2))

How to write a value in one cell if another cell equals X with multiple variations

I would like to place a value in column B depending on the value in column A e.g. If the value in column A = Hat then the value in B would = Clothes, if it is Cat then the value would = Animal.
You have to create a table first with all the references and then use VLOOKUP() formula to search through the reference table and provide the result. See Screenshot:
Cell A2 has the data you're looking for. Cell B2 provides the result with the following formula:
=+VLOOKUP(A2,D2:E7,2,FALSE)
Table in columns D:E is the reference where the search is done.

Vlookup search in a comma separated field

Excel worksheet with 2 columns.
Cell A1 has values like 111,222-225,333 then cell A2 almost same format data like 010,011,444-499.
How can we lookup a value, say 333 and output corresponding value on adjacent column --(in column B or C etc)?
Vlookup doesn't seem to be a good choice as the first column value needs to be unique.
Secondly, how could we tackle the same above scenario if the lookup value is in that range (say 224, which is in the range of 222-225)
I am not sure what value you want to have, but if you want to have the whole cell u might use:
=LEFT(A1;FIND("333";A1)+3)
in B1 and simply fill it to the rest of column B.
You could share a worksheet with Googledocs with data people could share.
But in essence you would be doing something like string manipulation on A1, to extract the 333.
a1=111,222-225, 333
b1=VALUE(RIGHT(TRIM(A1),3))
c1==VLOOKUP(B1,E1:F2,2,FALSE) // a
d1==IF(ISNA(C1),"",C1) // a
e1=333 e2=a
f1=444 f2=b
The // a - represents the calculated content of the cell

Resources