Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating Range Arguments for use in function statements

Can any of you Excel gurus tell me how to create a
reference range from cell values that can be used as
Function statement arguments? Take for example, the
following Excel function: SUMIF(A5:A10,"=Z",B5:B10)

This function sums all the numbers in the range from B5
to B10 where the corresponding rows of the adjacent
column A contains the text value "Z".

I could define (name) the ranges A5:A10 and B5:B10 as
rng1 and rng2, respectively. This would allow the above
SUMIF function to look like: SUMIF(rng1,"=Z",rng2), but
this is not what I'm looking for.

If I hve 8 separate cell values for the row and column
numbers of the start and end of each of these two ranges
(5, 1, 10, 1 and 5, 2, 10, 2), is there any way I can use
those values along with any appropriate Excel functions
to create cell ranges that can be used for the range
arguments inside the SUMIF statement? From what I can
determine, range arguments cannot be text values. So, for
example, I couldn't use the ADDRESS function.

It seems to me that I did this a number of years ago
using R-C formatted range references, but I can't
remember exactly how I did this. Any help you can give me
would be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Creating Range Arguments for use in function statements

Is this what you are looking for?

ActiveCell.FormulaR1C1 = "=SUMIF(R5C1:R10C1,""Z"",R5C2:R10C2)"

Or if you want to separate out the 8 numbers so you can substitute cell
references instead:

ActiveCell.FormulaR1C1 = "=SUMIF(R" & 5 & "C" & 1 & ":R" & 10 & "C" & 1 &
",""Z"",R" & 5 & "C" & 2 & ":R" & 10 & "C" & 2 & ")"

--

Vasant




"Bill D." wrote in message
...
Can any of you Excel gurus tell me how to create a
reference range from cell values that can be used as
Function statement arguments? Take for example, the
following Excel function: SUMIF(A5:A10,"=Z",B5:B10)

This function sums all the numbers in the range from B5
to B10 where the corresponding rows of the adjacent
column A contains the text value "Z".

I could define (name) the ranges A5:A10 and B5:B10 as
rng1 and rng2, respectively. This would allow the above
SUMIF function to look like: SUMIF(rng1,"=Z",rng2), but
this is not what I'm looking for.

If I hve 8 separate cell values for the row and column
numbers of the start and end of each of these two ranges
(5, 1, 10, 1 and 5, 2, 10, 2), is there any way I can use
those values along with any appropriate Excel functions
to create cell ranges that can be used for the range
arguments inside the SUMIF statement? From what I can
determine, range arguments cannot be text values. So, for
example, I couldn't use the ADDRESS function.

It seems to me that I did this a number of years ago
using R-C formatted range references, but I can't
remember exactly how I did this. Any help you can give me
would be greatly appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Creating Range Arguments for use in function statements

Thanks, Vasant.
I apologize for not stating the problem more clearly. I'm
sure your solution would work, but it's not exactly what
I'm looking for. I didn't want to write a separate VB
macro. I was hoping to construct a single-cell formula
for the SUMIF function directly in the worksheet w/o
having to run a separate macro. I would have to run the
macro to get it to update but a single cell function
would automatically update with cell changes.

Any other ideas?


-----Original Message-----
Is this what you are looking for?

ActiveCell.FormulaR1C1 = "=SUMIF

(R5C1:R10C1,""Z"",R5C2:R10C2)"

Or if you want to separate out the 8 numbers so you can

substitute cell
references instead:

ActiveCell.FormulaR1C1 = "=SUMIF(R" & 5 & "C" & 1 & ":R"

& 10 & "C" & 1 &
",""Z"",R" & 5 & "C" & 2 & ":R" & 10 & "C" & 2 & ")"

--

Vasant




"Bill D." wrote in

message
...
Can any of you Excel gurus tell me how to create a
reference range from cell values that can be used as
Function statement arguments? Take for example, the
following Excel function: SUMIF(A5:A10,"=Z",B5:B10)

This function sums all the numbers in the range from B5
to B10 where the corresponding rows of the adjacent
column A contains the text value "Z".

I could define (name) the ranges A5:A10 and B5:B10 as
rng1 and rng2, respectively. This would allow the above
SUMIF function to look like: SUMIF(rng1,"=Z",rng2),

but
this is not what I'm looking for.

If I hve 8 separate cell values for the row and column
numbers of the start and end of each of these two

ranges
(5, 1, 10, 1 and 5, 2, 10, 2), is there any way I can

use
those values along with any appropriate Excel functions
to create cell ranges that can be used for the range
arguments inside the SUMIF statement? From what I can
determine, range arguments cannot be text values. So,

for
example, I couldn't use the ADDRESS function.

It seems to me that I did this a number of years ago
using R-C formatted range references, but I can't
remember exactly how I did this. Any help you can give

me
would be greatly appreciated.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Creating Range Arguments for use in function statements

The only solution I can think of is:

=SUMIF(INDIRECT(CHAR(1+64)&5&":"&CHAR(1+64)&10),"Z ",INDIRECT(CHAR(2+64)&5&":
"&CHAR(2+64)&10))

which is kludgy and limited, but should work for columns A through Z.

--

Vasant



wrote in message
...
Thanks, Vasant.
I apologize for not stating the problem more clearly. I'm
sure your solution would work, but it's not exactly what
I'm looking for. I didn't want to write a separate VB
macro. I was hoping to construct a single-cell formula
for the SUMIF function directly in the worksheet w/o
having to run a separate macro. I would have to run the
macro to get it to update but a single cell function
would automatically update with cell changes.

Any other ideas?


-----Original Message-----
Is this what you are looking for?

ActiveCell.FormulaR1C1 = "=SUMIF

(R5C1:R10C1,""Z"",R5C2:R10C2)"

Or if you want to separate out the 8 numbers so you can

substitute cell
references instead:

ActiveCell.FormulaR1C1 = "=SUMIF(R" & 5 & "C" & 1 & ":R"

& 10 & "C" & 1 &
",""Z"",R" & 5 & "C" & 2 & ":R" & 10 & "C" & 2 & ")"

--

Vasant




"Bill D." wrote in

message
...
Can any of you Excel gurus tell me how to create a
reference range from cell values that can be used as
Function statement arguments? Take for example, the
following Excel function: SUMIF(A5:A10,"=Z",B5:B10)

This function sums all the numbers in the range from B5
to B10 where the corresponding rows of the adjacent
column A contains the text value "Z".

I could define (name) the ranges A5:A10 and B5:B10 as
rng1 and rng2, respectively. This would allow the above
SUMIF function to look like: SUMIF(rng1,"=Z",rng2),

but
this is not what I'm looking for.

If I hve 8 separate cell values for the row and column
numbers of the start and end of each of these two

ranges
(5, 1, 10, 1 and 5, 2, 10, 2), is there any way I can

use
those values along with any appropriate Excel functions
to create cell ranges that can be used for the range
arguments inside the SUMIF statement? From what I can
determine, range arguments cannot be text values. So,

for
example, I couldn't use the ADDRESS function.

It seems to me that I did this a number of years ago
using R-C formatted range references, but I can't
remember exactly how I did this. Any help you can give

me
would be greatly appreciated.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Creating Range Arguments for use in function statements

Hi Vasant
I would skip the CHAR part of your formula and use the R1C1 notation
instead.
=SUMIF(INDIRECT("R" & 1 &"C" & 5 &":R"& 1 &"C" &
10,false),"Z",INDIRECT("R" & 2 &"C" & 5 &":R"& 2 &"C" & 10,false))

For the OP: Now you can replace the values 1,2,5 with cell references

--
Regards
Frank Kabel
Frankfurt, Germany

"Vasant Nanavati" <vasantn *AT* aol *DOT* com schrieb im Newsbeitrag
...
The only solution I can think of is:


=SUMIF(INDIRECT(CHAR(1+64)&5&":"&CHAR(1+64)&10),"Z ",INDIRECT(CHAR(2+64)
&5&":
"&CHAR(2+64)&10))

which is kludgy and limited, but should work for columns A through Z.

--

Vasant



wrote in message
...
Thanks, Vasant.
I apologize for not stating the problem more clearly. I'm
sure your solution would work, but it's not exactly what
I'm looking for. I didn't want to write a separate VB
macro. I was hoping to construct a single-cell formula
for the SUMIF function directly in the worksheet w/o
having to run a separate macro. I would have to run the
macro to get it to update but a single cell function
would automatically update with cell changes.

Any other ideas?


-----Original Message-----
Is this what you are looking for?

ActiveCell.FormulaR1C1 = "=SUMIF

(R5C1:R10C1,""Z"",R5C2:R10C2)"

Or if you want to separate out the 8 numbers so you can

substitute cell
references instead:

ActiveCell.FormulaR1C1 = "=SUMIF(R" & 5 & "C" & 1 & ":R"

& 10 & "C" & 1 &
",""Z"",R" & 5 & "C" & 2 & ":R" & 10 & "C" & 2 & ")"

--

Vasant




"Bill D." wrote in

message
...
Can any of you Excel gurus tell me how to create a
reference range from cell values that can be used as
Function statement arguments? Take for example, the
following Excel function: SUMIF(A5:A10,"=Z",B5:B10)

This function sums all the numbers in the range from B5
to B10 where the corresponding rows of the adjacent
column A contains the text value "Z".

I could define (name) the ranges A5:A10 and B5:B10 as
rng1 and rng2, respectively. This would allow the above
SUMIF function to look like: SUMIF(rng1,"=Z",rng2),

but
this is not what I'm looking for.

If I hve 8 separate cell values for the row and column
numbers of the start and end of each of these two

ranges
(5, 1, 10, 1 and 5, 2, 10, 2), is there any way I can

use
those values along with any appropriate Excel functions
to create cell ranges that can be used for the range
arguments inside the SUMIF statement? From what I can
determine, range arguments cannot be text values. So,

for
example, I couldn't use the ADDRESS function.

It seems to me that I did this a number of years ago
using R-C formatted range references, but I can't
remember exactly how I did this. Any help you can give

me
would be greatly appreciated.



.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Creating Range Arguments for use in function statements

Hi Frank:

Of course I agree. But the OP said he specifically wanted to use numeric
values for rows and columns (5,1,10,1,5,2,10,2), so I came up with this
awkward construction <g.

Regards,

Vasant.

"Frank Kabel" wrote in message
...
Hi Vasant
I would skip the CHAR part of your formula and use the R1C1 notation
instead.
=SUMIF(INDIRECT("R" & 1 &"C" & 5 &":R"& 1 &"C" &
10,false),"Z",INDIRECT("R" & 2 &"C" & 5 &":R"& 2 &"C" & 10,false))

For the OP: Now you can replace the values 1,2,5 with cell references

--
Regards
Frank Kabel
Frankfurt, Germany

"Vasant Nanavati" <vasantn *AT* aol *DOT* com schrieb im Newsbeitrag
...
The only solution I can think of is:


=SUMIF(INDIRECT(CHAR(1+64)&5&":"&CHAR(1+64)&10),"Z ",INDIRECT(CHAR(2+64)
&5&":
"&CHAR(2+64)&10))

which is kludgy and limited, but should work for columns A through Z.

--

Vasant



wrote in message
...
Thanks, Vasant.
I apologize for not stating the problem more clearly. I'm
sure your solution would work, but it's not exactly what
I'm looking for. I didn't want to write a separate VB
macro. I was hoping to construct a single-cell formula
for the SUMIF function directly in the worksheet w/o
having to run a separate macro. I would have to run the
macro to get it to update but a single cell function
would automatically update with cell changes.

Any other ideas?


-----Original Message-----
Is this what you are looking for?

ActiveCell.FormulaR1C1 = "=SUMIF
(R5C1:R10C1,""Z"",R5C2:R10C2)"

Or if you want to separate out the 8 numbers so you can
substitute cell
references instead:

ActiveCell.FormulaR1C1 = "=SUMIF(R" & 5 & "C" & 1 & ":R"
& 10 & "C" & 1 &
",""Z"",R" & 5 & "C" & 2 & ":R" & 10 & "C" & 2 & ")"

--

Vasant




"Bill D." wrote in
message
...
Can any of you Excel gurus tell me how to create a
reference range from cell values that can be used as
Function statement arguments? Take for example, the
following Excel function: SUMIF(A5:A10,"=Z",B5:B10)

This function sums all the numbers in the range from B5
to B10 where the corresponding rows of the adjacent
column A contains the text value "Z".

I could define (name) the ranges A5:A10 and B5:B10 as
rng1 and rng2, respectively. This would allow the above
SUMIF function to look like: SUMIF(rng1,"=Z",rng2),
but
this is not what I'm looking for.

If I hve 8 separate cell values for the row and column
numbers of the start and end of each of these two
ranges
(5, 1, 10, 1 and 5, 2, 10, 2), is there any way I can
use
those values along with any appropriate Excel functions
to create cell ranges that can be used for the range
arguments inside the SUMIF statement? From what I can
determine, range arguments cannot be text values. So,
for
example, I couldn't use the ADDRESS function.

It seems to me that I did this a number of years ago
using R-C formatted range references, but I can't
remember exactly how I did this. Any help you can give
me
would be greatly appreciated.



.






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
Creating If Then statements from table Siper1 Excel Worksheet Functions 3 November 8th 07 10:51 PM
2 way Vlookup - Creating array arguments from columns Hari Excel Discussion (Misc queries) 1 May 11th 06 01:18 PM
Creating my own user defined function help statements Craig Excel Worksheet Functions 2 February 22nd 06 04:51 PM
creating function (vba) with range arguments Fredouille Excel Worksheet Functions 2 September 12th 05 11:01 AM
Select.Range function in VB IF statements? lykwid[_3_] Excel Programming 2 January 24th 04 12:08 PM


All times are GMT +1. The time now is 04:19 PM.

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

About Us

"It's about Microsoft Excel"