Hyperlink to matching text - excel

is there a way to make a dynamic hyperlink to matching text in excel? I have a spreadsheet that has company names and one is companies we've already got history with. so for the ones we already interact with I'd like to create a hyperlink to the same company on a different page within the same spreadsheet. I would just hyperlink to cell but sometimes the text changes place as it's an ever changing document.
looking for something like (using apple as company example)
hyperlink ("companies sheet [cell containing "apple" text]", "partners sheet [cell containing "apple" text])
does this exist?

Have you looked at the cell, match and index functions: MATCH, INDEX, CELL?
The MATCH function returns the position of a lookup value in a range.
INDEX returns the value at a given location in a range and CELL returns information about a cell in a worksheet.
Example: =HYPERLINK("#" & CELL("address", INDEX(Details!B5:B9, MATCH(D4, Details!B5:B9, 0))), "Click to See Details")
The MATCH function returns the position when it finds the match and then INDEX traverses to that cell to retrieve the value. But here the CELL function plays its part. You can see we have set “address” as the info_type of CELL. So, rather than fetching the value, it will get the cell reference itself.

Related

Index/Match returning wrong value

Summary tab:
Source tab:
I'm having some trouble using index match combo and getting the data to reference correctly.
what I am trying to achieve is in a tab called "Summary" I have a calendar with range D5:O6. the first cell in the calendar should change everyday to reflect the current date which will change the rest of the row making a rolling calendar. I have a data reference sheet called "PFS" from which the data needs to be referenced.
The thing I'm having trouble with is that with the formula
=INDEX(PFS, MATCH(A8,Snames,0),MATCH(D5,Sdates,0))
is returning the top left intersection (B8 of the source tab) of A8 and D5 values smith, bob & 4-Aug. a cell that i have entered the value "Wrong Corner".
Snames A8:A9, Sdates D5:O5 are the rows and columns containing the dates and names from the Summary tab
what I need help with is why its returning the wrong intersection and what I can do different to get the data I'm looking for.
The correct return would be the number one, which I have conditionally formatted to turn the cell blue and blank the text
You don't show what PFS references to. It seems to start in A1.
You can either use a range that starts in the correct cell, or add the required offset to the Match results.
=INDEX(PFS, MATCH(A8,Snames,0)+2,MATCH(D5,Sdates,0)+2)
Also make sure that Sname and Sdates refer to the ranges in the Source tab, not the Summary tab.

Is there a Excel Formula for auto filling a price when certain option of choices is picked?

I am working in Excel. I am trying to come up with a formula that is linked to a drop down menu of choices. I have attached an image below that shows a 'Status' column and 'Double Handling' column. My end goal is when you click a status option the corresponding price gets autofilled in the double handling column.
For example Status :Price
Unchecked :$400,
Checked :$600,
Laydown :$200,
in SWO :$200,
Progress :$200,
Paint :$200,
Laydown :$200,
Site :$200,
If you have your Drop Down options on another tab (a Lookup Sheet), then you can put the Price next to them, and use a VLOOKUP
=VLOOKUP(A1,LookupSheet!$A:$B, 2, FALSE)
This also lets you use a Named Range in your Drop-Downs, so that you just have to add or remove items to the Lookup Sheet, and it will automatically update all of your options. The Named Range would need to contain a Function that used INDEX to set the range, like this:
=LookupSheet!$A$1:INDEX(LookupSheet!$A:$A, MAX(COUNTA(LookupSheet!$A:$A), 1))
(If your Lookup Sheet includes a Header Row, then you will probably want to change $A$1 to $A$2, and that final , 1)) to , 2)) instead)
If you don't want to use a Lookup Sheet, you can include the Lookup Table in the function as an array:
=VLOOKUP(A1, {"Unchecked",400;"Checked",600;"Laydown",200;"in SWO",200;"Progress",200;"Paint",200;"Laydown",200;"Site",200}, 2, FALSE)
The whole array goes inside braces (curly brackets, {}), values on the same Row are separated with Commas ({Input,Output}), and Rows are separated with Semicolons ({Input1,Output1;Input2,Output2})
Though it may seem a bit lenghty, if for whatever reason you want to change up amount, I believe you could nicely implement CHOOSE here:
=CHOOSE(MATCH(A1,{"Unchecked Drawing","Checked Drawing","in SWO","Progress Assign LamSar Shop","Progress Assign Subcontractor","Paint","Laydown","Site"},0),400,600,200,200,200,200,200,200)
Range A1 in my formula refers to the cell with the drop-down. Also, when empty, there will be an error (since MATCH cannot find a match). You could counter that with wrapping the formula in an IFERROR(.....,"").

Excel input field that pulls data from range

I'm trying to create an input/search field in an excel sheet that when someone enters data in the field, it starts autopopulating from X Range, when they find the data they want they hit enter and it pulls from Y Range.
Closest I've found is XLOOKUP, but I can't get it to work on a field when someone types into that field. I want this to work through column A of the entire sheet, so when the user goes to a new line it does the same as the line above.
So, input data into A4, while typing it search C:C and auto fills in as I type. Once I find what I like I hit enter and it pulls the cell next to the C cell I found the data on, resulting cell data, so D:D column.
I've tried inputing this into a dropdown validate field, but no go, just errors out:
=XLOOKUP(INDIRECT("a9"), C:C, D:D)

Including tab name in formula from cell

Similarly to this thread I have found Click here...
I am trying to create various formulae looking across tabs with the tab names kept in cells. My hyperlink function has been successful as:
=HYPERLINK("#'"&B2&"'!A1","Click Here")
Where B2 represents a 2-3 character tab name of a person's initials (e.g. AA in this example).
However if I try this method with other formulae I am returning a #VALUE! error. Can anyone help me with making this nested Index/Match function work dynamically from cell B1 rather than being fixed to the tab name "AA"?
=IF(OR(INDEX(AA!B:AH,MATCH(TODAY()-WEEKDAY(TODAY(),11)+1,AA!B:B,0),2)="",INDEX(AA!B:AH,MATCH(TODAY()-WEEKDAY(TODAY(),11)+1,AA!B:B,0),10)="",INDEX(AA!B:AH,MATCH(TODAY()-WEEKDAY(TODAY(),11)+1,AA!B:B,0),14)="",INDEX(AA!B:AH,MATCH(TODAY()-WEEKDAY(TODAY(),11)+1,AA!B:B,0),22)=""),"No","Yes")
Thanks in advance?
Dan
The hyperlink function accepts a constructed string to use as the link and interprets it as a range address just as it would a true url. A formula cannot accept a constructed string address as a worksheet range reference but the INDIRECT function converts constructed strings to a usable worksheet range reference.
INDEX(AA!B:AH,MATCH(TODAY()-WEEKDAY(TODAY(),11)+1,AA!B:B,0),2)
... becomes,
INDEX(indirect(text(B2, "'#'!\B\:\H")), MATCH(TODAY()-WEEKDAY(TODAY(), 11)+1, indirect(text(B2, "'#'!\B\:\B")), 0), 2)
With AA in B2, text(B2, "'#'!\B\:\H") becomes 'AA'!B:H. I find it easier to take care of the wrapping ' marks with a format mask.

Comparing and counting values

I have a table, let's call it my Individuals Table, much like the one below, containing a column of individuals along with their corresponding codes listed in an adjacent cell. Codes for each individual are all listed within the same adjacent cell next to the individual's name, and separated by a carriage return.
Example table
What I'd like to do is the following:
Run through the code cell for each individual
For each code in the individual's code cell, check if this code exists in a separate Codes Table
If the code exists in the Codes Table, add n+1 to the total count for that code in an adjacent cell and add the individual's name to the list of individuals with that same code in another adjacent cell.
If the code does not exist in the Codes Table, add the code to the Codes Table, add n+1 to the total count for that code in an adjacent cell and add the individual's name to the list of individuals with that same code in another adjacent cell.
Result of running the algorithm on the example table
If a similar program can achieve the same results, then I'm open to that too.
I try to give you a possible solution, by minimizing the use of VBA code.
As starting point I would do is rearranging codes for every individuals. Keeping more codes in a single cell separed by a return it is not as easy to manage like having a single code for each cell. Of course I will keep each code associated with each individual. A way to do it is with your data is by using the formula substitute and replace the returns characters with a semicolon. The formula works this:
=SUBSTITUTE(B2,CHAR(13),CHAR(59))
B2 is the cell where you are converting returns to semicolon. You will then use this formula for all values in your B column.
Once you have replaced returns with semicolon, copy and paste values and then with the function "Text to Columns" in Data tab you will convert each cell to a series of columns (depending on how many codes you had listed in the original cell of your sheet). Now you will be in a situation where the first column you have the names of individuals, and then on the same row in the subsequent columns you have all associated codes, like in the picture here below:
In order to create a complete list of all codes you can easily copy all columns with codes. Paste the codes in a suitable space (I suggest in a new worksheet), and then with some copy and paste jobs put all codes under the same column. Select all codes and with the button "Remove Duplicates" always in the Data tab you will have a list of all unique codes included in your original table.
Then you can copy and paste the column with all unique codes you created under your "Codes" column. Now you can count the codes in the converted table with this formula:
=COUNTIF($B$1:$C$4, D2)
Where first argument of COUNTIF refers to the codes in the converted table and the second argument is a code in your column "Codes" where you pasted the unique codes.
Now as far as I know there is no function in Excel to create a list of names separated by commas (but I would be glad to discover that it exists if anybody knows!!!). Therefore I created a custom one with some VBA code with the name List Individuals:
Function ListIndividuals(refCode, NameRange As Range, CodesRange As Range) As String
'Check size in row number of NameRange and CodesRange is same, otherwise give error
If NameRange.Rows.Count <> CodesRange.Rows.Count Then
ListIndividuals = CVErr(xlErrRef)
Exit Function
End If
result = ""
For Col = 1 To CodesRange.Columns.Count
For n = 1 To CodesRange.Rows.Count
If CodesRange.Cells(n, Col).Value = refCode Then
If CodesRange.Cells(n, Col).Value <> "" Then
If result = "" Then
result = NameRange(n)
Else
result = result & ", " & NameRange(n)
End If
End If
End If
Next
Next
ListIndividuals = result
End Function
So last step is to use this formula under your "Individuals" cells as follows:
=ListIndividuals(D2,$A$13:$A$16,$D$13:$E$16)
Where first argument is the Code, the second one is the list of individuals in the converted table (it should be the first column), then the third one are the columns with the codes in the converted table. As a result of this custom formula you will have the list of individuals separated by commas.
All above works on my computer, but if you need more information, please do not hesitate to contact me.

Resources