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
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
Since the Product Description (Egg) and Cat (Breakfast) relate directly to the PLU Number, you can get them with simple Index-Match formulae:
Formula:
J5:
=INDEX($B$4:$B$29,MATCH(I5,$A$4:$A$29,0))
P5:
=INDEX($E$4:$E$29,MATCH(I5,$A$4:$A$29,0))
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:
=INDEX($D$4:$D$29,MATCH($I5&K$4,$A$4:$A$29&$C$4:$C$29,0))
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.
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.
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),"")
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));"")
Last edited by FioreMatto; 12-03-2018 at 04:23 PM.
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
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
For the errors in the right-hand table, you can wrap the array formula in IfError:
Formula:
=IFERROR(INDEX($E$4:$E$29,MATCH($J5&L$4,$A$4:$A$29&$C$4:$C$29,0)),"xx")
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.
I propose a formulaFormula:
=MAX(INDEX($D$5:$D$29*($A$5:$A$29=$R5)*($C$5:$C$29=T$4),0))
Many thanks, just what I needed.
Great advice and support.
Garry![]()
You're welcome, glad we could help and thanks for the rep.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks