How to hyperlink to a file that partially matches the cell value - hyperlink

I am a VB novice and have spent the last 3 hours trying to copy and paste and rework other peoples answers similar to what I'm looking for to no avail:
My spreadsheet has one column with many rows. All of the values in the rows virtually match the file names I want to link to except most have small differences.(ie. cell value is "RFI 246 Bld B-..." and filename is "RFI 246 Bldg B...".
The only things that are constant and unique to each pair of values and filenames is the sequence of the last 3 of the first 7 characters(RFI 246).
Is there a way to create hyperlinks from the cells to the pdf files by matching the first 7 characters in the cell to the first 7 characters in the filename?
Thank you

Related

How to specify a range in a Google Sheets formula, where the end row number is a reference to another cell?

I have several google spreadsheets with different number of records (rows) - let's say
file 1: 200.000 records (rows)
file 2: 350.000 records (rows)
file 3: 246.000 records (rows)
etc.
I use a lot of formulas (20-30) that reference entire columns from file 1:
sumif(a$2:a$200000,">3")
countif(b$2:b$200000, "=n")
etc.
I want to reuse the already created formulas for the other files, but since the number of records there is different, I would have to replace the 200.000 with 350.000 for file 2 in 20-30 cells, with 246.000 for file 3 in 20-30 cells etc.
That would be too much work.
Is there a way to specify the end point of the range not with a constant but by pointing to a cell that contains the number of rows?
e.g.
I would add in cell z1 the number of rows: 200000
The other formulas would contain something like
sumif(a$2:a$ (something that tells sheets to use as row number the number from z1) )
This way I would need to only replace the number in z1, and all formulas would be updated correctly. Any ideas?
I tried using indirect:
="a"&indirect("z1")
where z1 contains 200000
This pastes
a200000
But if I try using it in a range, it's not recognized as a range
=sum(a1:"a"&indirect("z1"))
Any ideas how to do that correctly?
why not just skip it... instead of:
=sumif(a$2:a$200000,">3")
use:
=sumif(a$2:a,">3")
to answer your indirecting, the correct syntax would be:
=sum(INDIRECT("a1:a"&z1))
You don't need to use the line numbers limit on this case.
Just use sumif(A$2:A,">3") and it will read the whole column A starting from line 2

Combine 2 REGEXREPLACE Formulas Into One

In cell C5, I have a date with dashes ---> 01-31-2013
I just need to remove the dashes, extract only the first 4 digits in the date (in this case, 0131), and append 'Efisd' at the BEGINNING of the string.
So, the end result should look like this ---> Efisd0131
So far, I've been able to remove the dashes, and extract the first 4 digits of the date. But, I can't seem to put append 'Efisd' to the beginning and put it all together into one formula.
Does anyone know how to do this? Thanks for your help.
Here's the sample spreadsheet that you can edit
From just the input date you can get it done with this:
="Efisd"&left(substitute(B5,"-",""),4)
It substitutes the dashes for blanks, gets the left 4 characters, and ads Efisd to the front.
If anyone wants the arrayformula version of this, here it is below. Put formula in very top cell in column, edit the header in between quotes, and change cell values to fit your spreadsheet.
={"Your Header";arrayformula(iferror(if(len(M2:M),"Efisd"&left(substitute(M2:M,"-",""),4),""),))}

Google Sheets - How to concatenate a range based on a matching value in another cell?

I have a sheet that lists through filenames of an image gallery. Each row represents a new image; has a unique filename, but has an associated non-unique page title, as follows:
title
filename
Page 1
img1.jpg
Page 1
img2.jpg
Page 1
img3.jpg
Page 2
img4.jpg
Page 2
img5.jpg
Page 2
img6.jpg
What I need to do is concatenate each file name into a single cell, (formatted in a particular way), as follows:
title
filename
Page 1
img1.jpg///img2.jpg///img3.jpg///
Page 2
img4.jpg///img5.jpg///img6.jpg///
I have tried everything I can think of using COUNTIF, UNIQUE but I can't seem to get anywhere.
I would just write a basic formula for if A1 = "Page 1"... but I have thousands of rows to do so it would take me days and days to write them all out manually changing the formula.
Oh wise wizards of Stackoverflow, please work your wizened magic and help me out with a formula? I have no idea how to use VBA but am willing to poke around if necessary.
Many many thank-yous!
Assuming the datarange in A2:B, try
=arrayformula({unique(A2:A), trim(transpose(query(if((transpose(unique(A2:A))=A2:A)*len(A2:A), B2:B&"///",),,50000)))})
Change range to suit and see if that works?
If you don't want to have any spaces in the output, try
=arrayformula({unique(A2:A), substitute(trim(transpose(query(if((transpose(unique(A2:A))=A2:A)*len(A2:A), B2:B&"///",),,50000)))," ",)})

Spreadsheet : Split text into predefined column

Please look at this sheet.
https://docs.google.com/spreadsheets/d/1gecstRTRdevMlvWsNdp0WZr1da2WZjwRt7cn2LRI7iA/edit?usp=sharing
Been on this for days, looked everywhere to no avail.
I have a group name in column C, separated with "/". In M3 I have a split formula, which will split the group in C into individual name and add a prefix to each. Works great. However, there are other data in between the names that's going to be pasted / entered. Therefore, I need the result to be shown in each 4 columns (yellow one), not next to each other like the current formula.
How to split C3 so that the result will be shown in each 4 columns ?
Note : column C can have 20 names at most.
Edit : Please spare the grammar of the sheet. I'm merely converting the data from my language into English while keeping the formula / cell intact, so it will look sluggish.

Small in arrayformula (Google Spreadsheet)

I have 5 columns of numbers that I want to sort per row into another set of columns. I figured I need to use small() (e.g. small(a2:e2,1) for f2; small(a2:e2,2) for g2 and so on). Is there away to iterate this for the next rows; if possible using only native google spreadsheet formulas?
Thanks in advance
I was able to make a temporary work around, but I had to use 3 cheat columns. It looks ok for now but I imagine it will be troublesome for really huge numbers.
Here's a sample sheet for reference: https://docs.google.com/spreadsheets/d/1MQTP2XkRsPRAnPQ5wLhkR8JoNVY6YOExVlOkkX8UeRs/edit#gid=0
The original data are in A3:E
The first cheat column (G3:G) simply creates a column of numbers from 1 to the largest number found in the source data. 1-9 is changed to 01-09 for easier searching. "#" is then added at the end-this will come handy later:
Cheat Column 1 =filter(if(row(A:A)=max(A:E)+1,ʺ#ʺ,text(row(A:A),ʺ00ʺ)),row(A:A)<=max(A:E)+1)
The second cheat column (H3:H) combines each row into a string separated by "-" with a "#" marker:
Cheat Column 2=filter(text(A3:A,ʺ00ʺ)&ʺ-ʺ&text(B3:B,ʺ00ʺ)&ʺ-ʺ&text(C3:C,ʺ00ʺ)&ʺ-ʺ&text(D3:D,ʺ00ʺ)&ʺ-ʺ&text(E3:E,ʺ00ʺ)&ʺ#ʺ,A3:A<>ʺʺ)
The last cheat column (I3:I) sorts each line (from cheat column 2) by finding each number from cheat column from 01 up to the max number, then the "#" char (this ensures that each line will still have the # end marker). "Find" will return the "position" of each number or an error if it's not found. By using "if", we can make "find" return the actual number or "" instead.
=filter(arrayformula(if(iferror(find(transpose(filter(G3:G,G3:G<>ʺʺ)),H3:H),ʺʺ), transpose(filter(G3:G,G3:G<>ʺʺ)),ʺʺ)),A3:A<>ʺʺ)
The formula above creates as many columns as there are numbers from cheat column 1. To prevent this, a "-" is added to each number then "Concatenate" is used to combine everything into one massive string with each set separated by "#". The string is then split using the "#" marker.
Cheat Column 3 =transpose(split(concatenate(filter(arrayformula(if(iferror(find(transpose(filter(G3:G,G3:G<>ʺʺ)),H3:H),ʺʺ),ʺ-ʺ&transpose(filter(G3:G,G3:G<>ʺʺ)),ʺʺ)),A3:A<>ʺʺ)),ʺ#ʺ))
Each number is then separated into each corresponding column by using mid().
Small 1 =filter(mid(I3:I,2,2)*1,A3:A<>ʺʺ)
Small 2 =filter(mid(I3:I,5,2)*1,A3:A<>ʺʺ)
Small 3 =filter(mid(I3:I,8,2)*1,A3:A<>ʺʺ)
Small 4 =filter(mid(I3:I,11,2)*1,A3:A<>ʺʺ)
Small 5 =filter(mid(I3:I,14,2)*1,A3:A<>ʺʺ)
Note that the formula above is only for numbers 1-99. For larger numbers, the Text() formulas should have more zeroes to correspond to the number of digits of the biggest number. The Mid() formulas should also be adjusted accordingly.
I would like to stress that I am very far from being a spreadsheet expert and that this solution is very "unoptimized". It requires several cheat columns; with the first one even having more rows than the original data. If anyone can help me get rid of the cheat columns (or at least the first one) I will be very grateful.
How about using SMALL like you mentioned in your question?
=small($A3:$E3,column()-columns($A3:$G3))
You will need to change the ranges accordingly. The last $G$3 is the cell just before the cell where the formula is placed.
Sample

Resources