I have the following Excel spreadsheet:
A B C D E F G
1 Sale 1 Sale 2 Sale 3
2 Product A 0 150 400 Sale 2 Sale 3
3 Product B 1.000 0 300 Sale 1 Sale 3
4 Product C 50 200 70 Sale 1 Sale 2 Sale 3
5 Product D 800 0 0 Sale 1
In Columns B:D you can see the Sales for each product.
In Columns E:G I want to show in which Sale the product was sold. Therefore, the Sale which is <> 0
should be shown.
So far used this formula:
=INDEX($B$1:$D$1,MATCH(TRUE,INDEX($B2:$D2<>0,),0))
but it only works if a product is sold only once (unique). Once the product appears in more sales as for example Product A this formula gives me only back the Sale 2 but it leaves out the Sale 3.
Is there a way to list each sale next to the product. Something like htis:
Transposition IF value <>0
In E2 and copied across and down to suit:
=IF(B2>0,B$1,"")
B2
is not anchored so will adjust to C2 etc when copied across (and B3 etc when copied down - equivalent to RC[-3]) whereas the row for B$1
is anchored so will not change (but the column will change in line with that for B2
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.