• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Extract a value and return column header|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / Extract a value and return column header|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…Extract a value and return column h…
sp_PrintTopic sp_TopicIcon
Extract a value and return column header
Avatar
kevin Langeveld
Member
Members
Level 0
Forum Posts: 11
Member Since:
February 9, 2022
sp_UserOfflineSmall Offline
1
February 14, 2022 - 11:20 pm
sp_Permalink sp_Print sp_EditHistory

Hi,

 

i am struggling with the following;

The columns having a value between 0 - 4 
If value is 1 or higher, I want to have the column header,

In the screenshot, I added 4 column with value 1,2,3,4.
there is need the result of the value.

 

So for example in row 9

In my value 1 I need 'Transito' (value in c9)

And in my value 2 I need 'Type_agaricus'  (Value in H9)

 

Voorbeeld.pngImage Enlarger

waarde-vinden.pngImage Enlarger

 

Anyone have a smart idea to extract this?

sp_PlupAttachments Attachments
  • sp_PlupImage Voorbeeld.png (82 KB)
  • sp_PlupImage waarde-vinden.png (87 KB)
sp_AnswersTopicSeeAnswer See Answer
Avatar
Alan Sidman
Steamboat Springs, CO
Member
Members


Trusted Members
Level 0
Forum Posts: 130
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
2
February 15, 2022 - 2:59 pm
sp_Permalink sp_Print

Will there ever be more than three columns with numbers between 1 and 4?

Avatar
Chris Yap
Member
Members
Level 0
Forum Posts: 162
Member Since:
August 21, 2019
sp_UserOfflineSmall Offline
3
February 15, 2022 - 6:36 pm
sp_Permalink sp_Print

Hi,

easier to do it in Power Query

Worksheet one is your source which consist only raw columns,  bring into Power Query,  the following are the M Code

let

    Source = Table1,

    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Index", "Groep", "Latijns"}, "Attribute", "Value"),

    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Custom", each if [Value]>= 1 then [Attribute] else ""),

    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] <> "")),

    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}),

    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Custom"),

    #"Sorted Rows" = Table.Sort(#"Pivoted Column",{{"Index", Order.Ascending}}),

    #"Removed Columns1" = Table.RemoveColumns(#"Sorted Rows",{"Index"}),

    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",Headers)

in

    #"Renamed Columns"

 

You can amend the values in some of the columns to more than 1,  and goto second tab the output table, right click and refresh to see the updated result

Rgds

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 612
Member Since:
November 1, 2018
sp_UserOnlineSmall Online
4
February 15, 2022 - 8:20 pm
sp_Permalink sp_Print

For a formula version, in C2:

=IFERROR(INDEX($G$1:$Y$1,AGGREGATE(15,6,1/($G2:$Y2>0)*(COLUMN($G2:$Y2)-COLUMN($G2)+1),COLUMNS($A$1:A$1))),"")

and copy across and down.

Avatar
kevin Langeveld
Member
Members
Level 0
Forum Posts: 11
Member Since:
February 9, 2022
sp_UserOfflineSmall Offline
5
February 15, 2022 - 9:39 pm
sp_Permalink sp_Print

Good solutions Velouria and Chris,

Chris, i am to nooby for understand what you did there =) but for now it worked.

 

Velouria, thanks tho! 

 

i also figured out later, that the =filter worked here

 

=FILTER(G$1:Y$1;G2:Y2>0;"")
sp_AnswersTopicAnswer
Answers Post
sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Philip Treacy, Velouria, Dario Serrati
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
yashal minahil
Oluwadamilola Ogun
Yannik H
dectator mang
Francis Drouillard
Orlando Inocente
Jovitha Clemence
Maloxat Axmatovna
Ricardo Freitas
Marko Meglic
Forum Stats:
Groups: 3
Forums: 24
Topics: 6200
Posts: 27182

 

Member Stats:
Guest Posters: 49
Members: 31861
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.