I want to ask about a formula. Is any way to do?

By waqas79 ·
I have first column in excel for specific entry like, "c", "p", etc, I want a formula which can only handles the cells of that row where "c" exist in first column. Actually i want to copy the other cells information of that specific row where "c" occur.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Reponse To Answer

by gechurch In reply to It depends

Ok, thanks for the clarification. As I understand it you have just one row of data that you ever want to display/print at any time (and you are just putting it on a second sheet so it can be formatted for printing).

That's fine, and there are a few ways to handle it. For all examples lets assume Sheet1 is where your rows of data are stored, and Sheet2 is where you want to display the particular data. On Sheet1 lets say column B stores first name, column C stores surname, column D stores address and column E stores city.

Method 1) Have the user manually enter the row number to pull the data from on your sheet to be printed. ie. have a label in Sheet2!A1 that says "Row # to print" and have the user enter the row number into cell Sheet2!B1.

You would then use the INDEX formula. This formula takes in an array of data (in our example, this will be Sheet1!A1:E10), a row number (this will be that value typed in to Sheet2!A2) and a column #. On Sheet2 click on the cell where you want the first name to be displayed and enter the formula "=INDEX(Sheet1!$A$1:$E$10,$B$1,1)". That formula says "here's my array, now return me the value of column #1 in the row I specified in cell B1 on this sheet". Now click wherever you want the surname to be displayed and enter the formula "=INDEX(Sheet1!$A$1:$E$10,$B$1,2)". You'll notice that's the exact same formula, but the last value is a 2 now, meaning "grab the value of column #2 in the row I specified". Or in other words "return the value in the surname column". Continue on like this until you are pulling in every column of data.

Method 2) is a similar approach to above. This time though we are going to have the user type a 'p' in column #1 on Sheet1 for the row they want to print. We will then write a formula that looks for the row with a 'p' in column #1 and will read the values for each column in this row.

To do so, enter the following formula on Sheet2 in the cell where you want the first name to appear "=VLOOKUP("p",Sheet1!A$1:$E$10,2,FALSE)". That formula says to Excel "Look for the value 'p' in the first column of the table Sheet1!A1:E10. Once you've found the row with the 'p', return the value in column #2 of that row". Obviously to return the surname you'll change the formula to "=VLOOKUP("p",Sheet1!A$1:$E$10,3,FALSE)" (to get the value of column #3) and so on.

There are a few other strategies, but the ones I can think of are basically just variations of the above.

Collapse -

Reponse To Answer

by waqas79 In reply to It depends

Thank You very much! its help alot. Both methods are good. But i will use 2nd method as it fulfill my requirement 100%.
In the same scenario please tell me if it possible I can also be able to copy the heading of any column of that specific in which the data entered by user.

Collapse -

Reponse To Answer

by gechurch In reply to It depends

Grabbing the column headings is simple since you know exactly which cell they are in. Your headings will all be in the first row of Sheet1, so all you need to do is hit "=" then enter the cell containing the heading.

For example (assuming the same layout of columns as I posted earlier) to grab the heading "First Name" you'd use the formula "=Sheet1!B1". To grab the surname heading you'd use "=Sheet1!C1" etc.

Related Discussions

Related Forums