REVERSE the data corresponding to value in the flag cell

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,213
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
My Data range is B2:F11 with a flag in corresponding row cell in A2:F11
This flag in A2:F11 is EITHER of 1 OR 0
Output required as in H2:L11 as:
If flag is 1, then corresponding row in H2:L11 SHOULD BE ‘SAME’
If flag is 0, then corresponding row in H2:L11 SHOULD BE ‘REVERSED’

How to accomplish?
Thanks in advance
I am using Excel 2007
Sheet1

ABCDEFGHIJKL
21778899100200 778899100200
302233445566 6655443322
4
5
6
7
8
9
10
11144125052 44125052

<colgroup><col style="FONT-WEIGHT: bold; WIDTH: 30px"><col style="WIDTH: 64px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 10px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"></colgroup><tbody>
</tbody>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
In h2 copied down & across
=IF($A2="","",IF($A2=1,B2,INDEX($B2:$F2,COLUMN($F2)-COLUMN(A2))))
 
Upvote 0
In h2 copied down & across
=IF($A2="","",IF($A2=1,B2,INDEX($B2:$F2,COLUMN($F2)-COLUMN(A2))))

Fluff
Just now...while re-trying........I 'inserted' 3 columns so that Column A got shifted to Column D; BUT I am getting #REF ! in the output cell!!!

Sheet1

DEFGHIJKLMNOPQ
20 778899100200 #REF !100998877
30 2250222222 #REF !22225022
4
5
6
7
8
9
10
110 22222 #REF !2222

<colgroup><col style="FONT-WEIGHT: bold; WIDTH: 30px"><col style="WIDTH: 64px"><col style="WIDTH: 64px"><col style="WIDTH: 64px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 10px"><col style="WIDTH: 46px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
M2=IF($D2="","",IF($D2=1,G2,INDEX($G2:$K2,COLUMN($K2)-COLUMN(D2))))
N2=IF($D2="","",IF($D2=1,H2,INDEX($G2:$K2,COLUMN($K2)-COLUMN(G2))))
O2=IF($D2="","",IF($D2=1,I2,INDEX($G2:$K2,COLUMN($K2)-COLUMN(H2))))
P2=IF($D2="","",IF($D2=1,J2,INDEX($G2:$K2,COLUMN($K2)-COLUMN(I2))))
Q2=IF($D2="","",IF($D2=1,K2,INDEX($G2:$K2,COLUMN($K2)-COLUMN(J2))))
M3=IF($D3="","",IF($D3=1,G3,INDEX($G3:$K3,COLUMN($K3)-COLUMN(D3))))
N3=IF($D3="","",IF($D3=1,H3,INDEX($G3:$K3,COLUMN($K3)-COLUMN(G3))))
O3=IF($D3="","",IF($D3=1,I3,INDEX($G3:$K3,COLUMN($K3)-COLUMN(H3))))
P3=IF($D3="","",IF($D3=1,J3,INDEX($G3:$K3,COLUMN($K3)-COLUMN(I3))))
Q3=IF($D3="","",IF($D3=1,K3,INDEX($G3:$K3,COLUMN($K3)-COLUMN(J3))))
M11=IF($D11="","",IF($D11=1,G11,INDEX($G11:$K11,COLUMN($K11)-COLUMN(D11))))
N11=IF($D11="","",IF($D11=1,H11,INDEX($G11:$K11,COLUMN($K11)-COLUMN(G11))))
O11=IF($D11="","",IF($D11=1,I11,INDEX($G11:$K11,COLUMN($K11)-COLUMN(H11))))
P11=IF($D11="","",IF($D11=1,J11,INDEX($G11:$K11,COLUMN($K11)-COLUMN(I11))))
Q11=IF($D11="","",IF($D11=1,K11,INDEX($G11:$K11,COLUMN($K11)-COLUMN(J11))))

<tbody>
</tbody>

<tbody>
</tbody>

Please check.
 
Upvote 0
The problem is that you have inserted two blank columns in E & G, not the blank columns in A:C.
What is you actual layout?
 
Upvote 0
With your original layout change the formula to
=IF($A2="","",IF($A2=1,B2,INDEX($B2:$F2,COLUMN($G2)-COLUMN(B2))))
 
Upvote 0
With your original layout change the formula to
=IF($A2="","",IF($A2=1,B2,INDEX($B2:$F2,COLUMN($G2)-COLUMN(B2))))
Little miss-communication from my side

1. My data range for both INPUT (B2:F11) & OUTPUT (H2:L11) looks ‘similar’ to the ‘actual’ location in the Worksheet. Here I mean instead of B2:F11 it is ‘actually at’ CB2:CF11 & instead of H2:L11 it is ‘actually at’DM2:DQ11.
2. So there are lot of columns BETWEEN INPUT range & OUTPUT range.
3. Both these ranges MAY shift as required in future & the formula in the OUTPUT cells has to take care.

Comments please.
 
Upvote 0
Little miss-communication from my side
That (IMO) the understatement of the year.
If you give us incorrect info, then you will get something that doesn't work in return.

Whilst you have now said where some of the data is located you haven't said where the initial criteria is is located.
 
Last edited:
Upvote 0
That (IMO) the understatement of the year.
If you give us incorrect info, then you will get something that doesn't work in return.

Whilst you have now said where some of the data is located you haven't said where the initial criteria is is located.

The initial criteria is located at U2:U11
 
Upvote 0
This, copied across and down, should be readily adaptable to work with the 3 sections anywhere.


Excel 365
DEFGHIJKLMNOPQR
11
20
90
101
11
12778899100200
132233445566
2056894
2144125052
22
23
24778899100200
256655443322
3249865
3344125052
Reverse Some
Cell Formulas
RangeFormula
N24=IF($K1=1,D12,INDEX($D12:$H12,COLUMNS($D12:$H12)+1-COLUMNS($N24:N24)))
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,794
Members
449,048
Latest member
greyangel23

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