IF X then display Range A in Range B

indygo

Board Regular
Joined
Dec 2, 2013
Messages
107
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
 

Some videos you may like

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,952
Office Version
365, 2010
Platform
Windows
The range F1:G4 is 8 cells but B1:D5 is 15 cells. What are you trying to do exactly?
 

indygo

Board Regular
Joined
Dec 2, 2013
Messages
107
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.
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,952
Office Version
365, 2010
Platform
Windows
That still doesn't explain the 7 cell difference between the 2 ranges. Can you provide a sample?
 

indygo

Board Regular
Joined
Dec 2, 2013
Messages
107
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


ABCDEFGHIJKLMNOPQRSTUVXYZAAABACAD
1CatDogCat
20.20.30.50.50.40.30.20.30.5
30.10.990.40.30.40.50.10.990.4
40.30.30.10.22.53.50.30.30.1
50.50.40.50.4
60.10.20.10.2
7
8
9

<tbody>
</tbody>
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,952
Office Version
365, 2010
Platform
Windows
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.

<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">Cat</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;;">0.2</td><td style="text-align: right;;">0.3</td><td style="text-align: right;;">0.5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;;">0.1</td><td style="text-align: right;;">0.99</td><td style="text-align: right;;">0.4</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;;">0.3</td><td style="text-align: right;;">0.3</td><td style="text-align: right;;">0.1</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style="text-align: right;;">0.5</td><td style="text-align: right;;">0.4</td><td style=";"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style="text-align: right;;">0.1</td><td style=";"></td><td style="text-align: right;;">0.2</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">A2:C20</th><td style="text-align:left">{=INDIRECT(<font color="Blue">A1</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />

<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">Dog</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;;">0.5</td><td style="text-align: right;;">0.4</td><td style="text-align: right;;">0.3</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;;">0.3</td><td style="text-align: right;;">0.4</td><td style="text-align: right;;">0.5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;;">0.2</td><td style="text-align: right;;">2.5</td><td style="text-align: right;;">3.5</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">A2:C20</th><td style="text-align:left">{=INDIRECT(<font color="Blue">A1</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />
 

Watch MrExcel Video

Forum statistics

Threads
1,099,008
Messages
5,466,002
Members
406,460
Latest member
tryingtogoalone

This Week's Hot Topics

Top