You are here:

# Excel/Transpose with a twist

Question

Transpose with a twist
QUESTION: Hello Bob,
I have a transposition question, but with a twist.
I think that explains everything clearly.
I have considered fancy lookups, index/match, and vba - all to no avail.
I'm not an expert vba guy like you, and I'm guessing this definitely needs a vba solution.
- Al Baker

ANSWER: Most would use a VBA solution, but here's a pure formula solution. Do exactly as these instructions show & it'll work. It's based on your example.
Put f1,f2,f3,f4 in D1:G1
in H2, put this formula (COlumns H:K will be hidden - they're helper columns)
=MATCH(D\$1,OFFSET(\$A\$1,H1,0,1000,1),0)+H1
Copy this formula to K2.
Copy H2:K2 down as far as you think necessary to hold all your values (maybe down to row 10000 or so)
(H1:K1 is left blank)

Put this formula in D2:
=IFERROR(INDEX(\$B:\$B,H2),"")
Fill right to G2
Fill D2:H2 down as far as necessary (this will contain your answers)

Hide columns H:K

Done (assuming auto calc is on! - else calculate)

---------- FOLLOW-UP ----------

QUESTION: Bob, your non-VBA solution is BRILLIANT.
However, and I guess I didn't make this clear enough, it's possible and likely that not all 4 fields will be filled out for each record. For instance, let's say that the 1st 2 records have all 4 fields filled out.  Your solution works great.
But for the 3rd record, only fields 1,3, and 4 are completed, i.e. field 2 is left blank.  So for the 4th record, your solution would put the field 2 entry into the 3 record.
My original image attachment shows an example where the 1st record is missing f4. Your solution would put f4 from the 2nd record into the row for the 1st record.

That said, your solution is extremely impressive. You're exactly right in that most would try a VBA solution and so that's what I've found.  But thank you so much for your efforts, Bob !

I don't think you can tell that something is missing. For example, suppose your first F1 is missing. From the first TWO records. How can I tell the first F1 found is actually from the 3rd record? I think you'd need to really keep placeholders until the data is found. Have f1,f2,f3,f4 always, but leave them blank if necessary. Even VBA would be really tough to know the first F1 is from the 3rd set!
Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Thanks very much !

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Bob Umlas

##### Expertise

I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at http://www.thumbtack.com/ny/new-york/excel-training/

##### Experience

Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Publications
Excellence, The Expert, Microsoft

Education/Credentials
BA in math, Hofstra University, 1965

Awards and Honors
MVP
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks