Tricky, extract change number from header

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Using Excel 2010
Hello,

I got header with numbers 1 to 14 in range C2:P2, example data text same/change in range C7:P50 (Real data range is C7:P6520)

I need to extract text change number from it corresponding header C2:P2 and result place in the columns S and AF,

Note: starting change header number has to be result below the below the same header number…for example row 7 first & second change start header is 2 so it has to be placed in range S and AF, starting below the header 2, same logic will be applied for all database (if change start 1, result below 1, if change start 2, result below 2, if change start 3, result below 3 and so on…)

Please advise a VBA solution, also formula if it is not complicate.

MrExcel Question.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAG
1
21234567891011121314
3
41234567891011121314
5SC1SC2SC3SC4SC5SC6SC7SC8SC9SC10SC11SC12SC13SC14ChaChaChaChaChaChaChaChaChaChaChaChaChaCha
6
7SameChangeChangeSameSameChangeChangeSameSameChangeChangeChangeChangeSame236710111213
8SameChangeChangeSameSameChangeChangeSameSameChangeChangeChangeChangeSame236710111213
9SameSameSameChangeSameSameSameSameChangeSameChangeSameChangeSame491113
10ChangeChangeSameSameChangeSameSameSameSameSameSameChangeSameSame12512
11ChangeSameChangeSameChangeChangeChangeSameChangeChangeChangeChangeSameChange13567910111214
12SameChangeChangeSameChangeChangeSameChangeChangeSameChangeSameChangeChange235689111314
13ChangeChangeChangeSameSameChangeSameChangeSameChangeChangeSameSameSame
14SameChangeChangeSameChangeSameChangeSameChangeSameSameChangeSameChange
15SameChangeChangeChangeChangeChangeChangeSameSameChangeSameSameSameChange
16ChangeChangeSameChangeSameChangeChangeChangeSameSameSameChangeSameChange
17ChangeSameSameChangeChangeChangeSameChangeChangeSameChangeSameSameChange
18SameSameChangeSameChangeChangeChangeSameSameChangeSameChangeChangeSame
19ChangeSameSameChangeChangeChangeSameSameSameSameChangeChangeChangeChange
20ChangeSameSameChangeSameSameChangeChangeSameSameChangeSameSameSame
21SameSameSameChangeSameSameChangeSameSameSameChangeSameSameChange
22ChangeSameChangeChangeChangeChangeSameChangeSameSameSameSameChangeChange
23ChangeSameChangeSameSameSameSameSameChangeChangeChangeChangeChangeChange
24ChangeSameSameChangeSameChangeChangeSameChangeChangeChangeChangeChangeChange
25ChangeSameSameChangeChangeSameChangeSameSameChangeSameSameSameChange
26ChangeSameSameSameChangeChangeSameSameChangeChangeSameSameChangeSame
27ChangeChangeChangeChangeChangeSameSameChangeChangeChangeSameChangeChangeSame
28SameChangeChangeSameChangeSameChangeSameChangeChangeSameSameSameChange
29SameSameSameSameChangeChangeSameChangeSameChangeChangeChangeChangeSame
30SameSameSameSameChangeSameChangeChangeChangeSameSameSameChangeSame
31SameSameSameSameSameSameSameChangeSameSameChangeSameSameChange
32SameChangeSameChangeChangeSameSameChangeChangeChangeSameChangeChangeSame
33ChangeSameSameSameSameSameChangeSameChangeSameChangeChangeSameSame
34ChangeSameSameChangeChangeSameChangeChangeSameChangeSameSameSameSame
35ChangeChangeSameChangeChangeChangeSameChangeChangeSameChangeChangeSameSame
36ChangeChangeChangeChangeChangeChangeChangeSameChangeSameChangeChangeSameChange
37ChangeChangeChangeChangeSameSameChangeChangeSameChangeSameChangeSameSame
38SameChangeSameSameChangeChangeSameSameSameSameSameChangeChangeChange
39SameChangeChangeSameSameChangeChangeChangeChangeSameSameSameSameChange
40ChangeSameChangeChangeSameSameSameSameChangeSameChangeChangeChangeChange
41ChangeChangeChangeChangeChangeChangeChangeChangeSameChangeChangeSameChangeSame
42SameSameSameSameChangeChangeChangeSameSameChangeChangeSameChangeSame
43SameSameChangeChangeSameSameSameSameSameChangeSameChangeSameSame
44SameSameSameSameChangeSameChangeSameChangeSameChangeSameChangeChange
45ChangeChangeChangeChangeSameChangeSameSameChangeSameChangeChangeSameChange
46SameSameChangeSameChangeSameChangeSameSameSameSameChangeChangeSame
47ChangeChangeSameSameChangeChangeChangeChangeSameSameSameSameSameSame
48ChangeSameSameChangeChangeSameChangeChangeSameSameSameSameChangeSame
49ChangeChangeChangeChangeSameSameSameSameChangeChangeChangeChangeChangeSame
50SameSameChangeSameChangeChangeChangeSameChangeChangeChangeChangeChangeChange
51
52
Sheet9
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C6:P5009Cell Value="Same"textNO


Regards,
Moti
 

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
Here is a formula-based solution:
Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1
21234567891011121314
3
41234567891011121314
5SC1SC2SC3SC4SC5SC6SC7SC8SC9SC10SC11SC12SC13SC14ChaChaChaChaChaChaChaChaChaChaChaChaChaCha
6
7SameChangeChangeSameSameChangeChangeSameSameChangeChangeChangeChangeSame 236710111213     
8SameChangeChangeSameSameChangeChangeSameSameChangeChangeChangeChangeSame 236710111213     
9SameSameSameChangeSameSameSameSameChangeSameChangeSameChangeSame   491113       
10ChangeChangeSameSameChangeSameSameSameSameSameSameChangeSameSame12512          
11ChangeSameChangeSameChangeChangeChangeSameChangeChangeChangeChangeSameChange13567910111214    
12SameChangeChangeSameChangeChangeSameChangeChangeSameChangeSameChangeChange 235689111314    
13ChangeChangeChangeSameSameChangeSameChangeSameChangeChangeSameSameSame123681011       
14SameChangeChangeSameChangeSameChangeSameChangeSameSameChangeSameChange 235791214      
15SameChangeChangeChangeChangeChangeChangeSameSameChangeSameSameSameChange 2345671014     
16ChangeChangeSameChangeSameChangeChangeChangeSameSameSameChangeSameChange1246781214      
17ChangeSameSameChangeChangeChangeSameChangeChangeSameChangeSameSameChange1456891114      
18SameSameChangeSameChangeChangeChangeSameSameChangeSameChangeChangeSame  3567101213     
19ChangeSameSameChangeChangeChangeSameSameSameSameChangeChangeChangeChange145611121314      
Sheet1
Cell Formulas
RangeFormula
S7:AF19S7=IF(AND(COLUMNS($S7:S7)>=MATCH("Change",$C7:$P7,0),(COLUMNS($S7:S7)<=MATCH("Change",$C7:$P7,0)+COUNTIF($C7:$P7,"Change")-1)),AGGREGATE(15,6,$C$2:$P$2/($C7:$P7="Change"),COLUMNS($S7:S7)-MATCH("Change",$C7:$P7,0)+1),"")
 
Upvote 1
Solution
Cell Formulas
RangeFormula
S7:AF19S7=IF(AND(COLUMNS($S7:S7)>=MATCH("Change",$C7:$P7,0),(COLUMNS($S7:S7)<=MATCH("Change",$C7:$P7,0)+COUNTIF($C7:$P7,"Change")-1)),AGGREGATE(15,6,$C$2:$P$2/($C7:$P7="Change"),COLUMNS($S7:S7)-MATCH("Change",$C7:$P7,0)+1),"")
KRice, congratulation formula worked spot-on! I appreciate your time and help (y)

Have a good day and good luck!

Kind regards,
Moti :)
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
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