Get data from sheet depending on cell value - spreadsheet

I have a spread sheet that has multiple sheets, the first being "Main Sheet". The subsequent sheet names are the same as the values in column A of "Main Sheet".
Eg:
Main Sheet
Column A5 = 12345
Column A6 = 23456
I want to get the value of cell "Main Sheet"(B5) from sheet "12345"(B10) (the value in "Main Sheet"(A5)) and the value of cell "Main Sheet"(B6) from sheet "23456"(B10).
As the "Main Sheet" is continuously growing, I need to do this by a formula.
Any suggestions?

Your notation makes it seem like you're not using MS Excel, but if you ARE, this should solve your problem.
You will want to use the INDIRECT function. It will turn a string into a reference to a cell.
This means that you can do something like the following (in B1 of Main Sheet):
=INDIRECT(CONCATENATE("'", 'Main Sheet'!A1, "'!B10"))
Assuming that:
'Main Sheet'!A1 == abc123
The formula will give you the contents of:
'abc123'!B10

Related

VBA to jump to certain cell after changing contents of one

I am creating a spreadsheet that I want to force people to input certain information. Is there anyway of forcing people when changing the contents of a cell that once return or tab is entered that it jumps to another cell.
For Instance:
CELL C2 (Date) 01/01/2001
CELL C4 (EMPTY) JUMP HERE
So above I want someone to enter a date in C1 and when they change this is jumps to C3.
Kris
The selection of a specific cell in the first sheet:
ThisWorkbook.Sheets(1).Range("A2").Select
You can use name of the sheet as a string instead of 1 in sheets(1)

create list in excel based upon specific cells by pulling data from multiple sheets

I need to create a list based upon a matrix template from multiple sheets within the same workbook.
I've got a grid that looks like the below:
A1 Expert
A2 Intermediate
A3 Foundation
B4 Grade 1
C4 Grade 2
D4 Grade 3
So if the word "completed" is in cell B3 for instance, then the person has completed Foundation grade 1.
This will be the same template with a new worksheet for each person. The front worksheet needs to have an option to search who has completed what grade. For instance, "Bruce Wayne" sheet name has the word "completed" in cell C2 in his grid (so he has completed grade 2 intermediate") and when I search on the front worksheet for grade 2 intermediates to find out who has this, Bruce Wayne will appear in a list (along with anyone else who has that grade showing "completed" on their worksheet)
I know how to make a macro button, i know how to make a data validation list,
and I've found a macro to loop through all worksheets (https://support.microsoft.com/en-hk/help/142126/macro-to-loop-through-all-worksheets-in-a-workbook)
What I don't know is how to get it to return the sheet name (bruce wayne) to form a list on the front page of names rather than just the value (completed/in progress etc) and what is the simplest way to report it:
1.create a button for each grade/level option that populates the list of sheet names (that would total 9 buttons in this example)
create 2 drop-down list boxes, one with Grades and one with levels and then say if grade 1 and foundation are selected from the drop-down list then it populates the sheet names in another column next to them.
The tab name is created from a "rename sheet" macro which works fine:
https://www.extendoffice.com/documents/excel/2905-excel-rename-sheet-based-on-cell-value.html
so it doesn't necessarily have to report back the sheet name, it could just report back a separate cell that dictates the sheet name if that's easier.
I'm more confused after typing that than I was before! Can anyone understand this/help me?!
Sub LoopThroughSheets()
If worksheets ("OVERVIEW") GOTO C5="Grade 1" And E5="Foundation" Then
' I want this bit to say if the overview worksheet cell C5 contains grade 1 and cell e5 contains foundation then
'
=IF E13="completed", THEN ActiveSheet.Name = Range("I5:I11").Copy)
' I want this bit to then say if the word completed is present in cell E13 on any of the subsequent sheets it should copy the sheet name to the overview sheet in cells I5 to I11'
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Next ws
End Sub
A worksheet object has a Name property in VBA, which can be accessed. Check out the documentation.
If you need more specific help, please post code.

Replace reference in formula with precedent

I have an excel file with three sheets (1,2,3), in the first sheet are primary data, in the third sheet are final data for output and the second sheet is bridge between them. I need to update formulas in the third sheet so I can delete the second sheet.
For example, there is value in sheet "1" in cell A1, then in sheet "2" is C5='1'!A1, in sheet "3" B4='2'!C5, and I need to get in sheet "3" B4='1'!A1. I need to do this for thousands of cells, therefore it is impossible to do it manually and I was thinking about using macro, but I was unable to create such macro. Can somebody help me?
This question raised because the bridge in sheet "2" is complex and not only assign one value from sheet "1" to one cell but it also add up several cells from sheet "1" together, therefore there is not any simple way to replace the bridge by vlookup or similar function.
It's pretty difficult to answer this question the way you have written it. This is because it seems all the cells in Sheet3 point to a "random" spot in sheet 2. If there is no rhyme or reason to how sheet pulls its numbers, replacing the formulas could be hard. However, try this:
If sheet 3 cells only EVER refers to a single cell in sheet 2, and sheet to only EVER refers to sheet 1, then you can go to sheet 2, and press CTRL + H. This will bring up the "find and replace" function. Replace all instances of "=" with "ZZZZ=". When you look to sheet3, you will see that instead of giving the values calculated off of sheet1 through sheet 2, a cell in sheet3 could say something like "ZZZZ='sheet1'!A1+'sheet1'!B1", because that's the value of sheet 2 that it points at. From there, copy and paste all of sheet3 to values only. Then, CTRL + H again and replace all instances in sheet of "ZZZZ=" with "=".
However I doubt this will work as if sheet2 contains values used elsewhere in sheet2 to calculate, or if sheet3 refers to things in other ways, this will fall apart.

vlookup not finding vba cells

I have a table that uses a bit of vba to populate column b with id numbers.
I then have column c as a vlookup that gets a name based off the id, from another sheet. The vlookup in the first cell works fine and returns the correct name, John Doe.
When I drag down, the rest of the cells in column c return the same name as the first, John Doe. The vlookup in the other cells is exactly the same, except the reference cell does change, as expected....so, c2 = vlookup(b2, $range, col, false), c3= vlookup(b3..), c4=vlookup(b4,..), etc.
The catch is, when I look at the vlookup in c3 and click on b3, the cell changes to find the correct name (no longer John Doe). So it works fine. And I have to do that for every cell in column c.
It's like vlookup isn't aware that column b changed? Is that something that happens with vba? Is there a refresh command or some other way for vlookup to register that column b has changed without having to click on each individual vlookup function?
If you've entered a formula in a cell, then copied the formula to another cell and Excel hasn't updated your results, that means that Calculation Mode is Manual.
To fix it (depending on version, this is for Excel 2010)
Click on Formulas in the Ribbon
Click on Calculation Options
Click on Automatic
If you need to have it calculate manually (valuable for making many formula changes in a large worksheet):
Click on Formulas in the Ribbon
Click on Calculate Now to calculate the entire workbook, or
Click on Calculate Sheet to calculate the current worksheet
You can skip all the clicking by pressing F9 to Calculate Now or Shift-F9 to Calculate Sheet.

Hyperlink after Vlookup

This simple thing is eating my brain out. Here is the challenge:
I have 2 sheets in the same workbook. Say Sheet 1 and Sheet 2. I want to Vlookup for the value present in Sheet 1 Column A and Sheet 2 column B. If the value is found i want to put a hyperlink in Sheet 1 Column A to point it to Sheet 2 Column D. In simple words, there are program names present in both the sheets and associated risk in sheet 2. If the program is present in both the sheets then i want to navigate directly to the risk present in the Sheet 2 upon clicking the program name in Sheet1.
I am attaching the sample file with this thread. Please somebody help me. I have tried with vba and normal formulas. Nothing is being worked out.
SAmple file can be downloaded from here
Here's how you can do that with a formula. You'll need to change the workbook name in the HYPERLINK formula to match yours.
=IF(ISERROR(VLOOKUP($A1,Sheet2!$B:$B,1,0)),"",HYPERLINK("[StackTest.xlsx]'Sheet2'!D"&TEXT(MATCH($A1,Sheet2!$B:$B,0),"#"),"Click Here"))