ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing a formula in a variable (https://www.excelbanter.com/excel-programming/281347-writing-formula-variable.html)

Chris Dunigan

Writing a formula in a variable
 
Hi, hope someone out there can help me with this problem.

I have a simple formula:

=CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1, 7,1)
"A","Activity","List"))))

and i'd like that formula to be contained in a variable so that i can
use the formula on many worksheets within a workbook.

The problem that i'm coming across is to do with all the quotation
marks. Excel won't let me simply write:

formula1 = CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1,7 ,1)
"A","Activity","List"))))

Dows anyone have any suggestions about how to overcome this - maybe by
splitting the formula up into smaller components???


any helps greatly apprecieted.

chris

Tom Ogilvy

Writing a formula in a variable
 
formula1 = "CONCATENATE((MID(A1,4,3)),""_"",C1,""_"",((IF(MID (A1,7,1)
""A"",""Activity"",""List""))))"

Regards,
Tom Ogilvy


"Chris Dunigan" wrote in message
m...
Hi, hope someone out there can help me with this problem.

I have a simple formula:

=CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1, 7,1)
"A","Activity","List"))))

and i'd like that formula to be contained in a variable so that i can
use the formula on many worksheets within a workbook.

The problem that i'm coming across is to do with all the quotation
marks. Excel won't let me simply write:

formula1 = CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1,7 ,1)
"A","Activity","List"))))

Dows anyone have any suggestions about how to overcome this - maybe by
splitting the formula up into smaller components???


any helps greatly apprecieted.

chris




Tom Ogilvy

Writing a formula in a variable
 
Just to add.
I showed you how to set up the string you showed - I am not sure the string
you showed is a valid formula, but you should be able to adapt what I
provided.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
formula1 = "CONCATENATE((MID(A1,4,3)),""_"",C1,""_"",((IF(MID (A1,7,1)
""A"",""Activity"",""List""))))"

Regards,
Tom Ogilvy


"Chris Dunigan" wrote in message
m...
Hi, hope someone out there can help me with this problem.

I have a simple formula:

=CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1, 7,1)
"A","Activity","List"))))

and i'd like that formula to be contained in a variable so that i can
use the formula on many worksheets within a workbook.

The problem that i'm coming across is to do with all the quotation
marks. Excel won't let me simply write:

formula1 = CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1,7 ,1)
"A","Activity","List"))))

Dows anyone have any suggestions about how to overcome this - maybe by
splitting the formula up into smaller components???


any helps greatly apprecieted.

chris






Chris Dunigan

Writing a formula in a variable
 
Tom,

You're right - my formula was slightly wrong, but have tweaked it and
you're suggestion works perfectly.

Many Thanks,
Chris






"Tom Ogilvy" wrote in message ...
Just to add.
I showed you how to set up the string you showed - I am not sure the string
you showed is a valid formula, but you should be able to adapt what I
provided.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
formula1 = "CONCATENATE((MID(A1,4,3)),""_"",C1,""_"",((IF(MID (A1,7,1)
""A"",""Activity"",""List""))))"

Regards,
Tom Ogilvy


"Chris Dunigan" wrote in message
m...
Hi, hope someone out there can help me with this problem.

I have a simple formula:

=CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1, 7,1)
"A","Activity","List"))))

and i'd like that formula to be contained in a variable so that i can
use the formula on many worksheets within a workbook.

The problem that i'm coming across is to do with all the quotation
marks. Excel won't let me simply write:

formula1 = CONCATENATE((MID(A1,4,3)),"_",C1,"_",((IF(MID(A1,7 ,1)
"A","Activity","List"))))

Dows anyone have any suggestions about how to overcome this - maybe by
splitting the formula up into smaller components???


any helps greatly apprecieted.

chris





All times are GMT +1. The time now is 03:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com