formular1c1 questions

oaishm

Board Regular
Joined
Jan 30, 2009
Messages
97
This formula r1c1 stuff is like voodoo. There has to be documentation of it soemwhere. Anyway, here's my question:

Why doesn't the computer like this?
Worksheets("QOutput").Cells(x, y).FormulaR1C1 = "=SUMIF('R'!c[5]:c[5],QOutput!r[x]c[1]&'Q','R'!c[y+11]:c[y+11])"

Since the only way I can think of passing two parameters through the sumif statement is by concatenating them, I do that in the second parameter here: QOutput![r[x]c[1]&'Q'

I'd like the output in the cell to be:
=sumif(R!e:e,1Q,R!l:l)

where
x = 13
y=2
QOutput!a13.value = 1

Thanks for the help
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
What is 1Q? Named ranges can't start with a number.

Do you actually need R1C1? You can put A1 style formula in cells with VBA.

Are you running this through a loop? What range are you putting the formulas in? What is the first formula?
 
Upvote 0
I'm guessing this is what you want:
Worksheets("QOutput").Cells(x, y).FormulaR1C1 = "=SUMIF('R'!C5,'QOutput'!R" & x & "C1,'R'!C" & y + 11 & ")"
 
Upvote 0
Sorry, that didn't work. "Q1" is a text I have in a cell that tells me to sum a number in another cell in the same row. My fundamental problem is I don't know how to build a formula when I need quotes in my formula.
 
Upvote 0
So do you want the text Q1 hardcoded into the formula or do you want a cell reference there?

If you want Q1 hardcoded, try this:

Code:
Worksheets("QOutput").Cells(x, y).FormulaR1C1 = "=SUMIF('R'!C5,""Q1"",'R'!C" & y + 11 & ")"
 
Last edited:
Upvote 0
I got to the bottom of it. It's really inexplicable

This works

z = 13
Worksheets("QOutput").Cells(x + 12, y).FormulaR1C1 = "=SUMIF('R'!c5,rc[-1]&""Q"",'R'!c[13])"

This doesn't work

z = 13
Worksheets("QOutput").Cells(x + 12, y).FormulaR1C1 = "=SUMIF('R'!c5,rc[-1]&""Q"",'R'!c[z])"

I can't imagine why
 
Upvote 0
You would need to separate z from the rest of the string:

Code:
Worksheets("QOutput").Cells(x + 12, y).FormulaR1C1 = "=SUMIF('R'!c5,rc[-1]&""Q"",'R'!c[" & z & "])"
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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