Help with OFFSET

EvansB2

Board Regular
Joined
Nov 25, 2008
Messages
245
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I have a table below that consists of a list of projects in column A and on each row values are input representing year on year costs. I would like to put Table 1 in a list format as shown in Table 2. These are examples and the reality is that I have a lot of data to re-format and I'm thinking that an OFFSET formula would assist in this?

Table 1

ABCDEF
1ProjectYear 1Year 2Year 3Year 4Year 5
2A£500£100£300£0£500
3B£0£200£300£600£0
4C£0£0£450£450£800
5
6
7
<colgroup><col width="29" style="width: 22pt; mso-width-source: userset; mso-width-alt: 1060;"> <col width="58" style="width: 44pt; mso-width-source: userset; mso-width-alt: 2121;" span="6"> <tbody> </tbody>

Table 2
ABCDEF
1ProjectYear Value
2A1£500
3A2£100
4A3£300
5A4£0
6A5£500
7B1£0
<colgroup><col width="29" style="width: 22pt; mso-width-source: userset; mso-width-alt: 1060;"> <col width="58" style="width: 44pt; mso-width-source: userset; mso-width-alt: 2121;" span="6"> <tbody> </tbody>


Any help would be appreciated.

Regards

Ben
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Heres one way. I put Table 1 in A1:F4 of Sheet1 and the headers of Table 2 in A1:C1 of Sheet2. Then in Sheet2 A2,B2,C2 i placed these 3 formulas:

=INDEX(Sheet1!$A:$A,CEILING((ROW()-1)/(MATCH("zzz",Sheet1!$1:$1)-1),1)+1)
=MOD(ROW()+MATCH("zzz",Sheet1!$1:$1)-3,(MATCH("zzz",Sheet1!$1:$1)-1))+1
=INDEX(Sheet1!$A$1:$Z$1000,MATCH(A2,Sheet1!$A$1:$A$1000,0),MATCH("Year "&B2,Sheet1!$A$1:$Z$1,0))

They work for 1000 rows and 26 columns in Table 1. Drag down until the results start to error.
 
Last edited:
Upvote 0
Thanks for quick reply Steve,

Can you tell me what the "zzz" means?

Regards

Ben
 
Upvote 0
Ok.

I have applied formulas and in Sheet2 columns A & B work great, however in col C it returs "#N/A". I have double checked and nothing is amiss.

Can you think of any obvious errors I may have made?

Regards

Ben
 
Upvote 0
another option is PowerQuery
(PQ add-in - Excel 2010/2013, built-in - Excel 2016 and higher)

SourceResult
ProjectYear 1Year 2Year 3Year 4Year 5ProjectYearValue
A
500​
100​
300​
0​
500​
A1
500​
B
0​
200​
300​
600​
0​
A2
100​
C
0​
0​
450​
450​
800​
A3
300​
A4
0​
A5
500​
B1
0​
B2
200​
B3
300​
B4
600​
B5
0​
C1
0​
C2
0​
C3
450​
C4
450​
C5
800​

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Project"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(Table.ReplaceValue(#"Unpivoted Other Columns","Year ","",Replacer.ReplaceText,{"Attribute"}),{{"Attribute", "Year"}})
in
    #"Renamed Columns"[/SIZE]
 
Upvote 0
Ok.

I have applied formulas and in Sheet2 columns A & B work great, however in col C it returs "#N/A". I have double checked and nothing is amiss.

Can you think of any obvious errors I may have made?




Regards

Ben

What does this produce?


=MATCH("Year "&B2,Sheet1!$A$1:$Z$1,0)
 
Upvote 0
Steve, my mistake, I didn't have a space between thesecond exclamation mark, i.e. "Year".

All sorted. Thanks again.

Ben
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,854
Members
449,096
Latest member
Erald

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