• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Offset row moves depending on data - is there a formula to change the number of rows?

Sandy D

New Member
I have data being output in a really messy format and the team cut and paste each time to get a pretty version of the report. I offered to help automate but have come across an issue where the offset row number changes for each customer.

My sample file shows the messy data on DATA tab, the end result we are needing on the CLEAN tab. The Formulas tab is my start for this problem.

To start, I got a list of customers and determined we are looking for the Bill To account. This list is output with multiple versions of the same account, so column I has a formula to strip out duplicates. That is:
{=IFERROR(INDEX($B$2:$B$140, MATCH(0,IF(ISBLANK($B$2:$B$140),1,COUNTIF(I$1:I1, $B$2:$B$140)), 0)),"")}
Then column J can be a simple lookup for the name of the customer.

Column K is where I am stuck. Having named my full data table Pronto and column A of my data table AccCode, I now have a formula:
=IFERROR(OFFSET(INDEX(Pronto,MATCH($I2,AccCode,0),3),11,0),0)

The problem is, only the first customer is offset by 11 rows. The next with data in it should only be 10, the next one 12 and the last 13. In each case, the field names are the same so I tried putting another match formula in and it didn't work. Anyone got a way of moving the number of offset rows automatically?

Thanks heaps!
Sandy
 

Attachments

  • Sample Lookup range gap.xlsx
    56.1 KB · Views: 7
In "Formulas Sheet" K2, formula copy down :

=IFERROR(INDEX(INDEX(DATA!C$1:C$1000,MATCH(I2,DATA!A$1:A$1000,0)):DATA!C$1000,MATCH("Customer Transaction Totals:",INDEX(DATA!A$1:A$1000,MATCH(I2,DATA!A$1:A$1000,0)):DATA!A$1000,0)),"")

Edit : Do not use whole column reference in your formula, which will slow down your computer performance.

Regards
 
Back
Top