Sorting based on input

abhi234u

New Member
Joined
Sep 10, 2007
Messages
37
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi there,

I have a below challenge in front of me. When ever the user inputs a value from source, that value should be first in the destination and the rest of source values should be sorted as below. Any inputs please. Below are examples

<table>
<thead>
<tr>
<th class="Source-cell">Source</th>
<th class="Input Cell-cell">Input Cell</th>
<th class="Output-cell">Output</th>
</tr>
</thead>
<tbody>
<tr class="firstRow">
<td class="Source-cell">abc</td>
<td class="Input Cell-cell">abc</td>
<td class="Output-cell">abc</td>
</tr>
<tr>
<td class="Source-cell">xyz</td>
<td class="Input Cell-cell"></td>
<td class="Output-cell">efg</td>
</tr>
<tr class="lastRow">
<td class="Source-cell">efg</td>
<td class="Input Cell-cell"></td>
<td class="Output-cell">xyz</td>
</tr>
</tbody>
</table>




<table>
<thead>
<tr>
<th class="Source-cell">Source</th>
<th class="Input Cell-cell">Input Cell</th>
<th class="Output-cell">Output</th>
</tr>
</thead>
<tbody>
<tr class="firstRow">
<td class="Source-cell">abc</td>
<td class="Input Cell-cell">xyz</td>
<td class="Output-cell">xyz</td>
</tr>
<tr>
<td class="Source-cell">xyz</td>
<td class="Input Cell-cell"></td>
<td class="Output-cell">abc</td>
</tr>
<tr class="lastRow">
<td class="Source-cell">efg</td>
<td class="Input Cell-cell"></td>
<td class="Output-cell">efg</td>
</tr>
</tbody>
</table>
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
selectionabc
Source
abcabcabc below is M20
xyzefg<<<<<
efgxyz#####
abcefg
xyz
efgabc
xyz
xyzabc
formula in cell marked <<<<<efg
=OFFSET($M$19,MATCH($F$17,$M$20:$M$25,0),1)
formula in cell marked #####
=OFFSET($M$19,MATCH($F$17,$M$20:$M$25,0)+1,1)

<colgroup><col width="64" span="13" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Here is my cells for source and destination

<table>
<thead>
<tr>
<th class="Cell-cell">Cell</th>
<th class="Source-cell">Source</th>
<th class="Input Cell-cell">Input Cell</th>
<th class="Desired Output-cell">Desired Output</th>
<th class="Cell-cell">Cell</th>
</tr>
</thead>
<tbody>
<tr class="firstRow">
<td class="Cell-cell">E2</td>
<td class="Source-cell">abc</td>
<td class="Input Cell-cell">xyz</td>
<td class="Desired Output-cell">xyz</td>
<td class="Cell-cell">G2</td>
</tr>
<tr>
<td class="Cell-cell">E3</td>
<td class="Source-cell">xyz</td>
<td class="Input Cell-cell">Cell F2</td>
<td class="Desired Output-cell">abc</td>
<td class="Cell-cell">G3</td>
</tr>
<tr class="lastRow">
<td class="Cell-cell">E4</td>
<td class="Source-cell">efg</td>
<td class="Input Cell-cell"></td>
<td class="Desired Output-cell">efg</td>
<td class="Cell-cell">G4</td>
</tr>
</tbody>
</table>
 
Upvote 0
M19 is an empty cell used as the starting point in the offset formula

F17 is the abc that the user has selected
 
Upvote 0
Below is what i am getting after i apply the formula

abc
0 <<<<< =OFFSET($F$6,MATCH($F$2,$E$2:$E$4,0),1)
0 #### =OFFSET($F$6,MATCH($F$2,$E$2:$E$4,0)+1,1)


Thanks
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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