Multiple ranges in RSQ Function formula - excel

I have two data sets to compare using the Excel RSQ Function. The first dataset comprises straightforward sequential cells in a row (A1:D1). The second dataset in the row below takes its final cell from a different reference in the spreadsheet(A2:C2,G12). Can't get the formula with 3 references to work. I seem to have tried all combinations and even read up on array formulas thinking this might help but no luck. Can this even be done?
Obviously the following doesn't work, but for clarity, this is kind of what I'm after:
=RSQ(A1:D1,(A2:C2,G12))
Any help much appreciated.

You don't mention whether this needs to be dynamic or not, so we can use a static array construction:
=RSQ(A1:D1,IF({1,1,1,0},A2:C2,G12))
Note that, if you're not using an English language-version of Excel, the separator within the array constant (here a comma) may require changing.
Regards

Try to replace (A2:C2,G12) with CHOOSE({1;2;3;4},A2,B2,C2,G12).
For completeness, another method. Replace with :
N(INDIRECT({"A2";"B2";"C2";"G12"})).

Related

Combine two lists in Excel, one underneath the other

I have two lists of products in Excel. Each list will be of varying length each month.
Is there a way to combine the two lists into a third list, with the second list being underneath the first?
I would like to do this avoiding macros.
I image this could be done using Dynamic Arrays, but I can't figure it out.
Please see an example below:
Thank you so much in advance.
I have had this problem before and used this tutorial to help me. I attach the example sheet also, which provides the formula that may work for your problem.
See the image below for cell references - then try this:
=IFERROR(INDEX($B$3:$B$7, ROWS(H2:$H$2)), IFERROR(INDEX($D$3:$D$4, ROWS(H2:$H$2)-ROWS($B$3:$B$7)), IFERROR(INDEX($F$3:$F$6, ROWS(H2:$H$2)-ROWS($B$3:$B$7)-ROWS($D$3:$D$4)), "")))
I have managed to find a solution that works for me, where the lists are of variable length.
Using a similar scenario to Mardi-Louise's answer, I am using the following formula in cell F3, and then dragging down:
=IF(B3<>"",B3,OFFSET($D$3,ROW()-COUNTA($B$3:$B$7),0))
Explanation:
So long as List 1 is not finished, it takes the value from List 1.
Once List 1 is finished, it begins at the top of List 2, and uses an offset to move down.
I'm late to the party, but for anyone still looking for this there's (now) a function for this in Excel 365: vstack(array1;array2;...)
Here is Microsoft's page on it
With the arrays as columns in tables you'll get dynamic lengths. It's also possible to combine vstack() with for example unique().
I benefitted from Answer 2 with slightly different syntax. The ROW() function provides an output based on the absolute cell address when an output based on the relative position of the list is actually more generally applicable. I found the following syntax works better to reference the output of ROW() to the cell above the top cell of range D3:D8:
=IF(B3<>"",B3,OFFSET($D$2,ROW()-ROW($D$2)-COUNTA($B$3:$B$7),0))
Additionally, the COUNTA function can provide inconsistent results when cells in the range are not based on simple data but on the output of formulas which can be equal to 0 or blank without actually being empty. In that case COUNTIF often works better such as:
=IF(B3<>"",B3,OFFSET($D$2,ROW()-ROW($D$2)-COUNTIF($B$3:$B$7,"<>"&0),0))

Excel: Provide a split range as one input

Normally in Excel, if I wanted to input a range into a function I would use C8:D13 But what If I split the rows with a row in between, but still wanted that range. So it would be C8:C13 + E8:E13?
But how can one insert this as a single range?
Excel cannot directly concatenate arrays in the way you describe (i.e.
simply combining them back to back.) However, there is a (complicated)
solution to this problem without using helper functions.
You can check out the rest of the details here.
Without knowing more about the problem, it's hard to give an appropriate solution. However, you may look into using TEXTJOIN() with a comma for a delimiter, and set ignore blanks as TRUE, then split the comma-seperated values again.
Some formulas may work differently, but for most, it's quite simple:
Original range:
=SUM(C8:D13)
After inserting a column (automatically updates):
=SUM(C8:E13)
Manual correction to ignore new column:
=SUM(C8:C13,E8:E13)

Nested if/then statement syntax

I've been reading a bunch of answers around nesting if/then statements in Excel but I can't figure out how to fix a "formula parse error" in mine. From what I can tell and in my code editor the formula is correct. Any ideas what I'm missing here?
I have a row of cells that auto-generate a number 1-35 based on other values. I want the cell with the formula to pull data from another row based on what's the in row of numbers 1-35. It works when I test one at a time; it's the nesting that is causing the errors. Thanks!
=IF(E$167=1,C56,IF(E$167=2,D56,IF(E$167=3,E56,IF(E$167=4,F56,IF(E$167=5,G56,IF(E$167=6,H56,IF(E$167=7,I56,IF(E$167=8,J56,IF(E$167=9,K56,IF(E$167=10,L56,IF(E$167=11,M56,IF(E$167=12,N56,IF(E$167=13,O56,IF(E$167=14,P56,IF(E$167=15,Q56,IF(E$167=16,R56,IF(E$167=17,S56,IF(E$167=18,T56,IF(E$167=19,U56,IF(E$167=20,V56,IF(E$167=21,W56,IF(E$167=22,X56,IF(E$167=23,Y56,IF(E$167=24,Z56,IF(E$167=25,AA56,IF(E$167=26,AB56,IF(E$167=27,AC56,IF(E$167=28,AD56,IF(E$167=29,AE56,IF(E$167=30,AF56,IF(E$167=31,AG56,IF(E$167=32,AH56,IF(E$167=33,AI56,IF(E$167=34,AJ56,IF(E$167=35,AK56,””)))))))))))))))))))))))))))))))))))
You might have run into a function nesting limit. Try the choose function to work around it.
How about using
=IF(AND(E167>0,E167<36),OFFSET(B56,0,E167),"")
Note : OFFSET is a volatile function, see this for details.
A simple vlookup or hlookup function can do exactly what you need without righting long nested if statement.
for example you can use:
=vlookup(E$167,$A1:$B35,2,false) where $A1:$B35 is the table array containing column A (1-35) and column B its corresponding value.

Using SUMPRODUCT and OFFSET on multiple rows in Excel

I have a question on using OFFSET in Excel.
For instance, I have a table with values varying by years.
Then, I have a table with some values varying by year/months.
!!Click here for the tables!!
I would like to write a formula e.g.
=SUMPRODUCT((E2:E37)*OFFSET(A1,C2:C37,1),E2:E37)
but it returns #VALUE!
In short, I would like to use an array of values in C2:C37 i.e. {1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3} to obtain the array {0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.03,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,}, and this array is then used in the SUMPRODUCT function.
Can someone help me solve the #VALUE! issue?
Thanks in advance!
Apparently (I didn't know this) Offset is unusual because it can return a set of range objects when used with an array as the second argument. Most functions can't handle this if you pass it to them. But if you put it through the N function, you get the right answer.
=SUMPRODUCT((E2:E37)*N(OFFSET(A1,C2:C37,1)))
or
=SUMPRODUCT((E2:E37),N(OFFSET(A1,C2:C37,1)))
Note that these appear to give an array of #Value! errors when you run them through Evaluate Formula but these resolve after passing through the N function.
Of course it would be more common to do this the easy way and use Index or Vlookup with a helper column. My first thought when trying to do it in a single Array formula without using Offset was this:-
=SUM(E2:E37*MMULT(N(C2:C37=TRANSPOSE((ROW(A2:A4)-1))),B2:B4))
I would think that the Offset way is easier and more efficient.
But in this particular case where there are only a small number of categories you could use this array formula which is perhaps the simplest approach:-
=SUM(CHOOSE(C2:C37+1,0,B2,B3,B4)*E2:E37)
The above formulae only work for the special case where the 'key' is the same as the row number in the lookup column. The offset method can easily be adapted to incorporate a lookup:-
=SUM((E2:E37)*N(OFFSET(A1,IFERROR(MATCH(C2:C37,A2:A4,0),0),1)))
See this reference

Excel Match function with columns having R1C1 reference style

I am using excel to look through my data, I have a matrix of 2000 columns and thousands of rows.
I want to search for some string in a specific column. I've been reading online and the Match() function is usually used for this. I am not sure of 2 things actually:
1-how to formulate the command since I have my columns as R1C1 reference style? (I mean I have numbers instead of letters as columns names)
2- I don't know how many rows I have, I just want the function to search the entire column for this string.
Here's the command I found, which doesn't solve any of the 2 problems mentioned above
=MATCH("string",A1:A100, 0)
Thanks,
Here's a simple one:
=MATCH("string",A:A,0)
However, the preferred technique is to usually create a named reference. Then you can just use the name of the range that you want to search in your MATCH() formula. Named ranges are usually easier to work with in larger projects (or projects that start small but where you want to keep some flexibility in case the workbook gets larger).
Edit: If you want to stick to R1C1, the formula might look like this instead: =MATCH("string",C1,0)

Resources