Forum Discussion

Jpalaci1's avatar
Jpalaci1
Brass Contributor
Sep 02, 2021
Solved

Conditional Lookup Based on Two Different Tables to Produce Pivot

I need help making this pivot:   Columns E:G lookup the bottom master lookup (K6:N9). I then thought I would make a second transfer lookup (top one in K1:R4) to fill in columns H:I based on =...
  • SergeiBaklan's avatar
    Sep 02, 2021

    Jpalaci1 

    That's better to restructure data a bit and do everything with data mode, but it takes some time plus entire logic is unclear.

     

    As variant you may use formulas for

    (New) Sector

    =IFNA( LOOKUP( 2, 1/
      ([@Name] & [@Company] &[@[Original Sector]] = Lookup_1st[Name] & Lookup_1st[Company] & Lookup_1st[Original Sector] ) /
      (  ([@Year]*100+[@Month]) >= (YEAR(Lookup_1st[Start])*100 + MONTH(Lookup_1st[Start]) ) ) /
      ( ([@Year]*100+[@Month]) <= ( YEAR(Lookup_1st[End])*100 + MONTH(Lookup_1st[End]) ) ),
      Lookup_1st[New Sector] ), "")

    (New) Department

    =IFNA( LOOKUP( 2, 1/
      ([@Name] & [@Company] &[@[Original Sector]] = Lookup_1st[Name] & Lookup_1st[Company] & Lookup_1st[Original Sector] ) /
      (  ([@Year]*100+[@Month]) >= (YEAR(Lookup_1st[Start])*100 + MONTH(Lookup_1st[Start]) ) ) /
      ( ([@Year]*100+[@Month]) <= ( YEAR(Lookup_1st[End])*100 + MONTH(Lookup_1st[End]) ) ),
      Lookup_1st[New Department] ), "")

     

     PivotTable doesn't show months without data, nothing special to do

Resources