Extract cells values under conditions (ignore blank cells)

smide

Board Regular
Joined
Dec 20, 2015
Messages
164
Office Version
  1. 2016
Platform
  1. Windows
Hello.

In column A (A1:A200) I have a cities, in column B shipping costs and in column C there is a 'mark' (letter "A") or a blank cell.

I need to extract values for each city only if there is a mark in that row (row with letter A in column C).

Column E is already populated with all cities (from column A) and results for each city should be placed in corresponding row(s) (from column F to column Z).

example.

A B C D E F G
1Toronto 45 AToronto 45 33
2Melbourne 12Melbourne 76 44
3Melbourne 76 AVienna 96
4Vienna 18
5Toronto 9
6Melbourne 44 A
7Vienna 96 A
8Toronto 33 A
9Vienna 106
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
How about
Fluff.xlsm
ABCDEFGH
1
2Toronto45AToronto4533 
3Melbourne12Melbourne7644 
4Melbourne76AVienna96  
5Vienna18
6Toronto9
7Melbourne44A
8Vienna96A
9Toronto33A
10Vienna106
11
Sheet7
Cell Formulas
RangeFormula
F2:H4F2=IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($B$2:$B$100)/($A$2:$A$100=$E2)/($C$2:$C$100<>""),COLUMNS($E2:E2))),"")
 
Upvote 0
Solution
PQ solution (dynamic)

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    cTypes = Table.TransformColumnTypes(Source,{{"Column2", type text}}),
    fltr = Table.SelectRows(cTypes, each ([Column3] = "A")),
    grp = Table.Group(fltr, {"Column1"}, {{"Count", each Text.Combine(_[Column2],"|")}}),
    xMaxList =  List.Transform({
        1..List.Max(
         Table.AddColumn(grp, "Custom", each 
            List.Count(
                Text.PositionOfAny([Count], {"|"}, Occurrence.All)
            ))[Custom]
        ) +1
 
    }, each "V" & Text.From(_)),
    result = Table.SplitColumn(grp, "Count", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), xMaxList)
in
    result


Test multilevel drop-down list.xlsx
ABCDEFGHI
1Column1Column2Column3Column1V1V2
2Toronto45AToronto4533
3Melbourne12Melbourne7644
4Melbourne76AVienna96
5Vienna18
6Toronto9
7Melbourne44A
8Vienna96A
9Toronto33A
10
Sheet2
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top