+ Reply to Thread
Results 1 to 10 of 10

Data formula to transpose data from rows to columns

  1. #1
    Forum Contributor
    Join Date
    08-16-2009
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    109

    Data formula to transpose data from rows to columns

    Any help please.

    I have a very large list of products that are sold at different prices across different locations and I would like to some how use formulas to move the key data from rows to columns as shown in the enclosed example.

    Garry
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Data formula to transpose data from rows to columns

    Since the Product Description (Egg) and Cat (Breakfast) relate directly to the PLU Number, you can get them with simple Index-Match formulae:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    The Site Prices are a bit trickier but you can do it by concatenating what you want to lookup - combining the PLU No with the Site, like this in K5 (note the two & symbols to join the search terms and the columns being checked):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Important: this is an array formula so needs to be entered using Ctrl-Shift-Enter not just Enter. You will know the array is active when you see curly brackets { } appear around your formula - don't try to enter them yourself. If you do not Ctrl-Shift-Enter an array formula you will get an error or a clearly incorrect result. If that happens, just click into the formula bar and try again.

    You can then drag this formula to the right and you'll get the prices for the other columns.
    Then you can select J5:P5 and drag all the formulae down together to get the other rows (note - the answers don't match the figures in your right-hand table, but are correct from the left-hand one).

    Hope that does what you need.
    Last edited by Aardigspook; 12-03-2018 at 03:22 PM. Reason: Add colour to highlight part of formula
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,371

    Re: Data formula to transpose data from rows to columns

    For Product Descriptions put this on J5 and copied down:
    =IFERROR(INDEX($B$5:$B$29,MATCH(0,INDEX(COUNTIF($J$4:J4,$B$5:$B$29&""),0,0),0)),"")

    For Price put this on K5 and copied down and cross until Scotland:
    =IFERROR(INDEX($D$1:$D$29,SUMPRODUCT(($B$5:$B$29=$J5)*($C$5:$C$29=K$4)*ROW($D$5:$D$29)),0),"")

    For Category put this on P5:
    =IFERROR(INDEX($E$1:$E$29,SUMPRODUCT(($B$5:$B$29=$J5)*($C$5:$C$29=K$4)*ROW($E$5:$E$29)),0),"")
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,929

    Re: Data formula to transpose data from rows to columns

    How about a Pivot Table as shown in the attached.

    Data Range
    I
    J
    K
    L
    M
    N
    O
    25
    Sum of Site Price
    Site
    26
    Product description
    Cat
    Midlands
    North
    Scotland
    South
    Wales
    27
    Apple Pie
    Deserts
    0.8
    0.8
    0.7
    0.8
    0.6
    28
    Bacon
    Breakfast
    1.1
    1.1
    0.95
    1.2
    1.4
    29
    Coffee
    Drinks
    1
    0.9
    0.7
    1.1
    1.2
    30
    Egg
    Breakfast
    0.3
    0.4
    0.5
    0.2
    0.4
    31
    Scampi
    Lunch
    0.42
    0.41
    0.45
    0.43
    0.44
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    11-22-2018
    Location
    Roma,Italia
    MS-Off Ver
    2013
    Posts
    40

    Re: Data formula to transpose data from rows to columns

    Buonasera a tutti
    in I5 da trascinare a destra fino a J5 e poi in basso

    SE.ERRORE(INDICE(A$5:A$100;CONFRONTA(0;INDICE(CONTA.SE(I$4:I4;A$5:A$100&"");0));"")


    in K5 da trascinare a destra fino a P5 poi in basso

    =SE.ERRORE(INDICE(SCEGLI(SE(COLONNE($A$1:A1)<=5;1;2);$D$5:$D$100;$E$5:$E$100);AGGREGA(15;6;RIF.RIGA($A$5:$A$100)/($B$5:$B$100=$J5)-RIF.RIGA($A$5)+1;RESTO(RIF.COLONNA(A1)-1;5)+1));"")
    Attached Files Attached Files
    Last edited by FioreMatto; 12-03-2018 at 04:23 PM.

  6. #6
    Forum Contributor
    Join Date
    08-16-2009
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Data formula to transpose data from rows to columns

    Hi Aardigspook,

    Many thanks to you and others for your help.

    Seems to work quicker with this method as I have 20,000 records that the real file checks.

    Just 1 question, is there anyway to stop this error or add a marker say 'xx' if any of the fields shown in red are blank.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Data formula to transpose data from rows to columns

    For the errors in the right-hand table, you can wrap the array formula in IfError:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As it's already an array formula, adding the error catch shouldn't have much of an effect on speed.

    To highlight blanks in the left-hand table, I suggest using Conditional Formatting.
    1. Select your data in column A (A4:A29 in your sample, amend as needed for your real data - add enough rows to allow the data to grow - it won't make much speed difference if you add a few extra thousand).
    2. With those cells still selected, on the Home tab, click Conditional Formatting then New Rule then Use a formula to determine which cells to format.
    3. Enter this formula in the box at the bottom:
    =LEN(A4)=0
    4. Click the Format button and choose how you want to highlight the cells - red fill is generally good.
    5. Click OK.

    Hope that does what you want.

  8. #8
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,296

    Re: Data formula to transpose data from rows to columns

    I propose a formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    08-16-2009
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Data formula to transpose data from rows to columns

    Many thanks, just what I needed.

    Great advice and support.

    Garry

  10. #10
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Data formula to transpose data from rows to columns

    You're welcome, glad we could help and thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula to Find and Transpose Data in Columns to Rows
    By JRS09 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-11-2017, 04:52 PM
  2. Transpose Data from Columns to Rows after each unique data point
    By lnagell in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-01-2014, 08:10 PM
  3. Transpose data to columns from rows keeping unique data together
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2013, 12:23 AM
  4. getting data from columns to rows without using transpose
    By rachbendy in forum Excel General
    Replies: 6
    Last Post: 07-15-2012, 09:41 AM
  5. Transpose columns of data in rows
    By Absar in forum Excel General
    Replies: 4
    Last Post: 09-14-2010, 09:10 PM
  6. Replies: 3
    Last Post: 02-12-2009, 02:54 PM
  7. Data in columns to rows (not transpose...)
    By titus.hanke in forum Excel General
    Replies: 13
    Last Post: 12-01-2008, 09:43 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1