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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

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