Copy formula to non-blank cells in table and concatenate results

nevjones

New Member
Joined
Jun 14, 2011
Messages
12
Hi All,
Below is an extract of a table of data I currently have which in reality is much larger with 54 risks and 90 funds across the top.

Fund AFund BFund CFund DFund E
Risk_01_RTXXXXX
Risk_02_RTXX
Risk_03_RTX
Risk_04_RTXXX
Risk_05_RTXXXX
Result01,03,0501,02,04

<tbody>
</tbody>

I need to replace the X's with the risk number which I can do by using the mid function but as the table is so large is there a quick way of doing this in VBA instead of filtering by each fund and copying the formula down.

Also I need to concatenate the risk numbers to send to our developers with a comma in-between as shown in the example result for Funds A & B.

Thanks in advance!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I am not able to help you with VBA to replace all the X's with their numbers. But I can concatenate with a comma the results in each column by using the Excel 2016 function TEXTJOIN.

I added an extra column to extract the risk numbers and make things easier. Copy B2 down and C7 across.


Book1
ABCDEFG
1RiskRisk NumberFund AFund BFund CFund DFund E
2Risk_01_RT01XXXXX
3Risk_02_RT02XX
4Risk_03_RT03X
5Risk_04_RT04XXX
6Risk_05_RT05XXXX
7Concatenated Risks:01, 03, 0501, 02, 0401, 02, 04, 0501, 04, 0501, 05
Sheet50
Cell Formulas
RangeFormula
B2=MID(A2,6,2)
C7{=TEXTJOIN(", ",1,IF(NOT(ISBLANK(C2:C6)),$B$2:$B$6,""))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
That's great, thanks for your reply and help, much appreciated. It worked well and I've learnt a new function, saved me load of time.
Have a good weekend!
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,679
Members
449,463
Latest member
Jojomen56

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