Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default formula array in a macro

Hi I have two problems
Number 1 I have the following formula in my workbook [on sheet3] and I need
to copy the formula down, which is fine for the absolute address of
individual cells, however my problem is I need the formula to ref to the next
sheet when I copy it down. I wondered if there could be a simpler method by
using a formula macro.

=CONCATENATE(B3," ",'S1'!$E$5," ","He/She"," ",'S1'!$E$12," and
",'S1'!$E$19,".")

Problem number 2
I would like to concatenate he/she into the formula based on a whether a
student is male or female. Is this possible?

Kind Regards
Tanya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default formula array in a macro

Tanya,

The INDIRECT function does what you want. Put the sheet names in a
separate column, so when you copy down, the next formula picks up the
next sheet name. For example, with sheet names in column A,
C3 contains =CONCATENATE(B3," ",INDIRECT(A3&"!E5"),"
",INDIRECT(A3&"!E12")," ",INDIRECT(A3&"!E19"),".")
The cell addresses do not need the absolute form $E$5 because they are
text and won't increment with copy down.

Unless I already have a comma-separated list to put into CONCATENATE,
I prefer the concatenate operator over the function (it just seems
like less typing!):
C3 contains =B3&" "&INDIRECT(A3&"!E5")&" "&INDIRECT(A3&"!E12")&"
"&INDIRECT(A3&"!E19")&"."
If sheet names contain spaces, then the column A values must be
surrounded with apostrophes:
C3 contains =B3&" "&INDIRECT("'"&A3&"'!E5")&" "&INDIRECT("'"&A3&"'!
E12")&" "&INDIRECT("'"&A3&"'!E19")&"."

Problem 2
If column L has something that indicates male or female then
C3 formula is B3&" "&INDIRECT("'"&A3&"'!E5")&"
"&IF(L3="male","he","she")&" "&INDIRECT("'"&A3&"'!E12")&"
"&INDIRECT("'"&A3&"'!E19")&"."

Carl.

On May 11, 9:51 pm, Tanya wrote:
Hi I have two problems
Number 1 I have the following formula in my workbook [on sheet3] and I need
to copy the formula down, which is fine for the absolute address of
individual cells, however my problem is I need the formula to ref to the next
sheet when I copy it down. I wondered if there could be a simpler method by
using a formula macro.

=CONCATENATE(B3," ",'S1'!$E$5," ","He/She"," ",'S1'!$E$12," and
",'S1'!$E$19,".")

Problem number 2
I would like to concatenate he/she into the formula based on a whether a
student is male or female. Is this possible?

Kind Regards
Tanya



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default formula array in a macro

Thank you Sooo much, I have not heard of the INDIRECT function before and I
had seen the '&' used in place of concatenate but hadn't realised how it can
save so much typing.

I am still tinkering with your solution to problem 2, it just won't accept
the value 'M' or 'male'. I will look at it again tomorrow night and will get
back to you.

Again THANK YOU.
Regards
Tanya

"Carl Hartness" wrote:

Tanya,

The INDIRECT function does what you want. Put the sheet names in a
separate column, so when you copy down, the next formula picks up the
next sheet name. For example, with sheet names in column A,
C3 contains =CONCATENATE(B3," ",INDIRECT(A3&"!E5"),"
",INDIRECT(A3&"!E12")," ",INDIRECT(A3&"!E19"),".")
The cell addresses do not need the absolute form $E$5 because they are
text and won't increment with copy down.

Unless I already have a comma-separated list to put into CONCATENATE,
I prefer the concatenate operator over the function (it just seems
like less typing!):
C3 contains =B3&" "&INDIRECT(A3&"!E5")&" "&INDIRECT(A3&"!E12")&"
"&INDIRECT(A3&"!E19")&"."
If sheet names contain spaces, then the column A values must be
surrounded with apostrophes:
C3 contains =B3&" "&INDIRECT("'"&A3&"'!E5")&" "&INDIRECT("'"&A3&"'!
E12")&" "&INDIRECT("'"&A3&"'!E19")&"."

Problem 2
If column L has something that indicates male or female then
C3 formula is B3&" "&INDIRECT("'"&A3&"'!E5")&"
"&IF(L3="male","he","she")&" "&INDIRECT("'"&A3&"'!E12")&"
"&INDIRECT("'"&A3&"'!E19")&"."

Carl.

On May 11, 9:51 pm, Tanya wrote:
Hi I have two problems
Number 1 I have the following formula in my workbook [on sheet3] and I need
to copy the formula down, which is fine for the absolute address of
individual cells, however my problem is I need the formula to ref to the next
sheet when I copy it down. I wondered if there could be a simpler method by
using a formula macro.

=CONCATENATE(B3," ",'S1'!$E$5," ","He/She"," ",'S1'!$E$12," and
",'S1'!$E$19,".")

Problem number 2
I would like to concatenate he/she into the formula based on a whether a
student is male or female. Is this possible?

Kind Regards
Tanya




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default formula array in a macro

Carl I finally managed to get back to the problem and you have again been
very helpful with problem number two.

Thank You!!

Tanya

"Carl Hartness" wrote:

Tanya,

The INDIRECT function does what you want. Put the sheet names in a
separate column, so when you copy down, the next formula picks up the
next sheet name. For example, with sheet names in column A,
C3 contains =CONCATENATE(B3," ",INDIRECT(A3&"!E5"),"
",INDIRECT(A3&"!E12")," ",INDIRECT(A3&"!E19"),".")
The cell addresses do not need the absolute form $E$5 because they are
text and won't increment with copy down.

Unless I already have a comma-separated list to put into CONCATENATE,
I prefer the concatenate operator over the function (it just seems
like less typing!):
C3 contains =B3&" "&INDIRECT(A3&"!E5")&" "&INDIRECT(A3&"!E12")&"
"&INDIRECT(A3&"!E19")&"."
If sheet names contain spaces, then the column A values must be
surrounded with apostrophes:
C3 contains =B3&" "&INDIRECT("'"&A3&"'!E5")&" "&INDIRECT("'"&A3&"'!
E12")&" "&INDIRECT("'"&A3&"'!E19")&"."

Problem 2
If column L has something that indicates male or female then
C3 formula is B3&" "&INDIRECT("'"&A3&"'!E5")&"
"&IF(L3="male","he","she")&" "&INDIRECT("'"&A3&"'!E12")&"
"&INDIRECT("'"&A3&"'!E19")&"."

Carl.

On May 11, 9:51 pm, Tanya wrote:
Hi I have two problems
Number 1 I have the following formula in my workbook [on sheet3] and I need
to copy the formula down, which is fine for the absolute address of
individual cells, however my problem is I need the formula to ref to the next
sheet when I copy it down. I wondered if there could be a simpler method by
using a formula macro.

=CONCATENATE(B3," ",'S1'!$E$5," ","He/She"," ",'S1'!$E$12," and
",'S1'!$E$19,".")

Problem number 2
I would like to concatenate he/she into the formula based on a whether a
student is male or female. Is this possible?

Kind Regards
Tanya




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array formula SUMIF with 2D sum_range array Rich_84 Excel Worksheet Functions 3 April 3rd 09 10:46 PM
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Find specific value in array of array formula DzednConfsd Excel Worksheet Functions 2 January 13th 09 06:19 AM
copy one array formula to an array range guedj54 Excel Programming 2 October 29th 06 07:38 PM
Tricky array formula issue - Using array formula on one cell, then autofilling down a range aspenbordr Excel Programming 0 July 27th 05 03:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"