Assign =concat( to a button?

donnabee

New Member
Joined
Jan 30, 2023
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi there!
I'm essentially doing assessments in a workbook that has lines cut and pasted from a .csv
The csv is a list of photo names, coordinates etc.
I concat the photo names and then later all that information is fed into another workbook for upload - and the concat function tells that upload what photos to "take" from the folder.

The thing is, these sheets can be 10,000 lines plus so when identifying what photos I need, I end up typing =concat( hundreds of times.

I'd like to know if I can just have a button which would write the concat equation for me and I just go ahead and select the lines from there? So I select the cell where I'll be using the formula, press the button then hold control and click the cells containing the photos I need.

Please let me know if I haven't explained everything well enough.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
hello welcome to the board. Are you not able just use the Fill to transfer the formula all the way down. If not can you post examples of Cells, row, and column reference. It’s best if you post using XL2BB
 
Upvote 0
hello welcome to the board. Are you not able just use the Fill to transfer the formula all the way down. If not can you post examples of Cells, row, and column reference. It’s best if you post using XL2BB

Hi and thank you :)

I can't use fill for this column - if you see the image I have uploaded I'm using a traffic light system.
Green - start of damage
Yellow - damage continues
Red - damage stops

So I need to concat all the coloured rows, starting at the green one (I circled one for an example)

I probably should have uploaded the image to help explain, I apologise.
 

Attachments

  • Screenshot 2023-01-31 135917.png
    Screenshot 2023-01-31 135917.png
    41.4 KB · Views: 9
Upvote 0
Have you tried When you drag use the Fill without formatting. See image
 

Attachments

  • EC4C718E-10B8-403E-B36F-2B0F37644E99.jpeg
    EC4C718E-10B8-403E-B36F-2B0F37644E99.jpeg
    225.1 KB · Views: 4
Upvote 0
I should have mentioned you first need to use the custom sort to sort by filled color first before doing the above

See example of that Here
 
Upvote 0
Did you try post #5 first the. Fill without formatting
 
Upvote 0
Have you tried When you drag use the Fill without formatting. See image
That would concat all the photos, and I only need the photos on the coloured rows :)
Did you try post #5 first the. Fill without formatting
It won't work, I need the colors to run as per the traffic light - Green then the yellow then the red, for their specific sections.
 
Upvote 0
I need the colors to run as per the traffic light - Green then the yellow then the red, for their specific sections.
Not sure what exactly you mean. What column do have that determines the
No fill
Green - start of damage
Yellow - damage continues
Red - damage stops


Perhaps we can do an If statement might be a better approach. In the future if value becomes one of the filled colors the formula automatically adjust
 
Upvote 0
So I select the cell where I'll be using the formula, press the button then hold control and click the cells containing the photos I need.
See if you could use this. I have placed a Forms button in A1 (but it could be anywhere) and attached the following macro to it.

1675149775600.png


VBA Code:
Sub ConcatNames()
  Dim rFormula As Range, rPics As Range
 
  Set rFormula = Intersect(Selection, Columns("B"))
  Set rPics = Intersect(Selection, Columns("A"))
  If rFormula Is Nothing Or rPics Is Nothing Then
    MsgBox "Error"
  Else
    rFormula.Formula = "=CONCAT(" & rPics.Address(0, 0) & ")"
  End If
End Sub

Now select all the cells in column A that you want concatenated and the cell in column B where you want the formula. It does not matter what order you do those things.
I selected all the green cells (cell B20 was empty when I selected it) and then pressed the button

donnabee.xlsm
AB
1Filename
2Pic1|
3Pic2|
4Pic3|
5Pic4|
6Pic5|
7Pic6|
8Pic7|
9Pic8|
10Pic9|
11Pic10|
12Pic11|
13Pic12|
14Pic13|
15Pic14|
16Pic15|
17Pic16|
18Pic17|
19Pic18|
20Pic19|Pic2|Pic4|Pic5|Pic9|Pic11|Pic12|Pic13|Pic14|Pic18|
21Pic20|
Sheet1
Cell Formulas
RangeFormula
B20B20=CONCAT(A3,A5:A6,A10,A12:A15,A19)
 
Upvote 1
Solution

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top