IF X then display Range A in Range B

indygo

Board Regular
Joined
Dec 2, 2013
Messages
126
Office Version
  1. 365
Platform
  1. Windows
hi,

I'm looking for a formula to display a range of cells if condition is met.

For example IF A1 equals to "test" then display range F1:G4 in range B1:D5.

Any ideas?

Thank you
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
The range F1:G4 is 8 cells but B1:D5 is 15 cells. What are you trying to do exactly?
 
Upvote 0
It's a form of data validation to display only information that's relevant.

let's say you have 3 tables (or ranges) and you don't need to display all of them at once because they won't fit on one page so you can display only the one that you need based on X value.
 
Upvote 0
That still doesn't explain the 7 cell difference between the 2 ranges. Can you provide a sample?
 
Upvote 0
Sorry,
Let's assume ranges are equal, slightly different example:


Display range based on A1 in range A2:C9 from range O2:O9 or range V2:Y9


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[TD]T[/TD]
[TD]U[/TD]
[TD]V[/TD]
[TD]X[/TD]
[TD]Y[/TD]
[TD]Z[/TD]
[TD]AA[/TD]
[TD]AB[/TD]
[TD]AC[/TD]
[TD]AD[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Cat[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Dog[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Cat[/T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TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
OK.

Select each range in your table, excluding the header and name it using the value in the header.
Make sure you have any blanks in your table as ="" (If you don't do this, you will end up with zeros in your result cells)

In Columns A2:C, select the max amount of rows you would need and enter the following formula:
=INDIRECT(A1) and hit CTRL-SHIFT-ENTER rathern than just Enter.

Select Columns A:C and make a new Conditional Formatting Formula of =ISNA(A1) and format the font to white to hide all #N/A that will result from where there is no data in that spot.


Excel 2010
ABC
1Cat
20.20.30.5
30.10.990.4
40.30.30.1
50.50.4
60.10.2
Sheet1
Cell Formulas
RangeFormula
A2:C20{=INDIRECT(A1)}
Press CTRL+SHIFT+ENTER to enter array formulas.



Excel 2010
ABC
1Dog
20.50.40.3
30.30.40.5
40.22.53.5
Sheet1
Cell Formulas
RangeFormula
A2:C20{=INDIRECT(A1)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,128
Members
453,021
Latest member
Justyna P

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