Help converting formula to VBA

cspengel

Board Regular
Joined
Oct 29, 2022
Messages
173
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I've been struggling with this for a full day and it is driving me insane. I am a new to this and I cannot get this formula to work for the life of me. I have a feeling it may be due to certain parenthesis, but not sure. I keep getting a VALUE!# error.

Formula: =TEXTJOIN(" , ",1,IF(AM2:AU2=AX2,AM1:AU1,""))
Recorded macro and got this: .FormulaR1C1 = "=TEXTJOIN("","",1,IF(RC[-12]:RC[-4]=RC[-1],R[-1]C[-12]:R[-1]C[-4],""""))"

The columns are dynamic or could change. I was trying to start with the basics and see if I could get any formula to work. Please help. I am lost.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi & welcome to MrExcel.
You need to use Formula2R1C1 rather than FormulaR1C1
Also you will probably need to lock the first row like
VBA Code:
.Formula2R1C1 = "=TEXTJOIN("","",1,IF(RC[-12]:RC[-4]=RC[-1],R1C[-12]:R1C[-4],""""))"
 
Upvote 0
Solution
Hi & welcome to MrExcel.
You need to use Formula2R1C1 rather than FormulaR1C1
Also you will probably need to lock the first row like
VBA Code:
.Formula2R1C1 = "=TEXTJOIN("","",1,IF(RC[-12]:RC[-4]=RC[-1],R1C[-12]:R1C[-4],""""))"
Wow thank you so much for the quick solution! You are a true blessing.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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