I am having trouble with this issue for a week and haven't been able to make it right.
I have several cells in sheet1 in that when empty, the corresponding cell in sheet2 will be hidden, once the cell in sheet1 is NOT empty, the corresponding cell in sheet2 will be shown. For example:
Sheet1:
A1, A5, A10, A15 will be the cells that If blank, then:
If A1 is blank, then sheet2 row 1 will be hidden, once it's not blank, the row will be shown.
If A5 is blank, then sheet2 row 2 will be hidden, ....
If A10 is blank, then sheet2 row 3 will be hidden, ... and so on
The objective is that if someone types their name on A1 (for example), the row in sheet 2 will be shown, and they will use the information of that row. If the person decided to write the name in A5, then the row 2 from sheet 2 will be shown, instead and so on...
Is there a way to use VBA code to do that automatically so that it is easy to use for other people?
Related
I have two Excel sheets and I want to fetch data from the particular cell number from sheet1 to sheet2.
In sheet2 I have two columns: the first column contain the cell number of sheet1; and using that cell number I want to fetch that data into the adjacent cell.
Example:
Sheet1 : A15 contains "Hello"
Sheet2 : column A contains cell name and number
Worked example: in sheet2 cell A5 contains A15 so in B5 I want "Hello" (i.e. the data in A15 on sheet1)
INDIRECT
In Sheet2, cell B5 use the formula:
=INDIRECT("Sheet1!"&A5)
INDIRECT Links
Office
Support
ExcelJet
Contextures
I have two sheets. I am matching sheet1 A2 value with sheet2 A2 to get Sheet1 C2 Value in sheet2 C2.
In Sheet1, if the number (in Column A) is repeating then it will have
(blank) and AW. If the number is not repeating then it will have only
(blank).
In Sheet2, if the number (in Column A) is repeating then it will have
(blank) and AW. If the number is not repeating then it will have
(blank) or AW. Actually (blank) = BY
In sheet1 and sheet2, Repeating values are always adjacent to each
other.
Conditions are:
In Sheet1, A2 not repeating & B2 = (blank) then Copy the value and paste to sheet2 in Column C. It could be either BY and AW in Sheet B2. So, paste in both B2 & B3.
For Eg: In sheet1 A4 &A5 are equal; B4 = (blank); B5 = AW. So take
C4 value and paste in Sheet2 both C4 AND C5.(Or the cell where it gets matched)
For Eg: In sheet1 A16; B16 = (blank). But In sheet2; B16 = AW. So
take C16 value and paste in Sheet2 C16.(Or the cells where it gets matched). If both the values are (blank), then no problem.
In Sheet1, A2 repeating & B2 = (blank), A2 = A3, B3 = AW then Copy the value and paste to sheet2 in Column C2 and C3.
For Eg: In sheet1 A4 &A5 are equal; B4 = (blank); B5 = AW. So take
C4 & C5 value and paste in Sheet2 both C4 AND C5.(Or the cells where it gets matched).
Help me. How to change my formula
=IFERROR(INDEX(Sheet1!$C$2:$C$4000; MATCH(1; (Sheet1!$A$2:$A$3000=Sheet2!$A2)*(Sheet1!$B$2:$B$3000=Sheet2!$B2);0));"")
=IFERROR(INDEX(Sheet1!$C$2:$C$4000;MATCH(Sheet2!A2;Sheet1!$A$6:$A$3000;0));"")
place the following in C2 and copy down:
=if(OR(B2="BY",SHEET1!C2<>""),SHEET1!C2,SHEET1!C1)
you will then want to go back and add a special case for your first row of data since you do not want to copy information from C1.
Alternatively you could add that as an option to your formula, but it MAY be a wasted bit of effort in all remaining rows.
EDIT:
In the case where the pairs of numbers are out of sequence you could use:
=IFERROR(IF(OR(B2="BY",INDEX(Sheet1!C:C,MATCH(A2,Sheet1!A:A,0)+COUNTIF(A$2:A2,A2)-1)<>""),INDEX(Sheet1!C:C,MATCH(A2,Sheet1!A:A,0)+COUNTIF(A$2:A2,A2)-1),INDEX(Sheet1!C:C,MATCH(A2,Sheet1!A:A,0)+COUNTIF(A$2:A2,A2)-2)),"")
I am maintaining an excel sheet where Sheet1 A1 would be the name of people and B2 would be their contact number. All of the details are in sheet 2 row A and B.
So, what I want is if I put a valid name (i.e. should be in Sheet2 A) then it automatically finds the number of that name and adds in the second row. Is this possible? I have around 10-15 contacts there.
Assuming Sheet workers list is as follows:
then in Cell B2 of Sheet assignment received enter either of the following formulas
=VLOOKUP(A1,'workers list'!A2:B10,2,FALSE)
or
=INDEX('workers list'!B2:B10,MATCH(A1,'workers list'!A2:A10,0))
Change range as required.
Use this formula in sheet -1 B2 cell "=IF(A2="","",VLOOKUP(A2,Sheet2!$A:$B,2,0))"
and Dropdown this formula till you want
Sheet-2
Sheet-1
I have 2 sheets. The first sheet has 2 dropdowns with values matching columns in the 2nd sheet in column a and b. based on the user's selections in the sheet one drop downs, I would like to show the content of the cell c of the corresponding row.
For example:
User selects apples in dropdown c3 on sheet 1 and lemons in drop down c5 on sheet 1, both of which match values on sheet 2 in cells a7 and b7, now show the value in cell c7 from sheet 2 on sheet 1 cell c7.
In cell C7 type this formula:
=Index(Sheet2!C:C,Match(C3&C5,Sheet2!A:A&Sheet2!B:B,0))
Then press Ctrl + Shift + Enter so it becomes an array formula.
If you like, you can restrict the rows instead of using the entire column.
This might be confusing but I'll give this a go.
As in the title of this question, I need to link cells between two sheets. Seems simple enough, but I think in this case I need to include an IF function?
I want cell C2 in sheet 1 to display what is in cell B2 from sheet 2 IF cell A1 in sheet 1 is the same as cell B1.
In other words: I have 2 sheets, on the second page I have months in on row and in the row under I have values for those months. I want to be able to link sheet 1 and 2 so that if I select February in one cell in sheet 1, then the cell under February in sheet 2 (the value) is shown in another cell on sheet 1.
Help please?
I think the relationships are satisfied by:
=IF(A1='sheet 2'!B1,'sheet 2'!B2,"")
(in Sheet 1!C2) but have assumed that the result should be nothing if Sheet 1!A1 != Sheet 2!B2.
I think you might be looking for in cell C2 (if you are talking about A1 and B1 being from the same sheet like 1):
=IF(A1=B1,Sheet2!B2)
edit: can't read question, only works if A1 and B1 are on same sheet
If I am not misunderstanding your wish, there is the code below. Please insert it into cell C2 in Sheet1
=IF(A1=B1, Sheet2!B2, "")
But you did not provide what sheet of cell B1 in pharse
I want cell C2 in sheet 1 to display what is in cell B2 from sheet 2 IF cell A1 in sheet 1 is the same as cell B1
So, I assumed that it is the same as A1 that is Sheet1. If you want to compare with the cell B2 in another sheet please Insert Sheet2: before B1.