SOLVED

How do I obtain the corresponding headers of the values that are responsible for a particular sum

%3CLINGO-SUB%20id%3D%22lingo-sub-2531385%22%20slang%3D%22en-US%22%3EHow%20do%20I%20obtain%20the%20corresponding%20headers%20of%20the%20values%20that%20are%20responsible%20for%20a%20particular%20sum%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2531385%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EHow%20do%20I%20obtain%20the%20headers%20(in%20the%20row%201)%20that%20are%20responsible%20for%20the%20result%20obtained%20in%20the%20cell%20AV3.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ESay%20for%20all%20the%20values%20that%20sum%20up%20to%20780%20(cell%20AV3)%2C%20sum%20not%20exceeding%201000%2C%20I%20want%20the%20corresponding%20name%20of%20the%20headers%20in%20the%20row%201%20(TEXT%2020%2C%20TEXT%2021%2C%20TEXT%2023%2C%20TEXT%2026%2C%20TEXT%2028%2C%20TEXT%2029%2C%20TEXT%2032)%20in%20one%20cell%20or%20may%20be%20in%20the%20adjacent%20cells.%20Test%20file%20attached%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EKindly%20help.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2531385%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2531582%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20obtain%20the%20corresponding%20headers%20of%20the%20values%20that%20are%20responsible%20for%20a%20particular%20su%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2531582%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1099386%22%20target%3D%22_blank%22%3E%40pratik0545%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAssuming%20that%20you%20have%20Excel%202019%20or%20Excel%20in%20Microsoft%20365%3A%3C%2FP%3E%0A%3CP%3EIn%20AX2%2C%20confirmed%20with%20Ctrl%2BShift%2BEnter%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DTEXTJOIN(%22%2C%22%2CTRUE%2CIF(OFFSET(B2%2C%2C%2C%2CMATCH(AU2%2C%20SUBTOTAL(9%2COFFSET(B2%2C%2C%2C%2CCOLUMN(%24C%241%3A%24AS%241)-2))))%26gt%3B0%2COFFSET(%24B%241%2C%2C%2C%2CMATCH(AU2%2C%20SUBTOTAL(9%2COFFSET(B2%2C%2C%2C%2CCOLUMN(%24C%241%3A%24AS%241)-2))))%2C%22%22))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EFill%20down.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2531583%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20obtain%20the%20corresponding%20headers%20of%20the%20values%20that%20are%20responsible%20for%20a%20particular%20su%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2531583%22%20slang%3D%22en-US%22%3E%3DTEXTJOIN(%22%2C%22%2CTRUE%2CIF(OFFSET(B2%2C%2C%2C%2CMATCH(AU2%2C%20SUBTOTAL(9%2COFFSET(B2%2C%2C%2C%2CCOLUMN(%24C%241%3A%24AS%241)-2))))%26gt%3B0%2COFFSET(%24B%241%2C%2C%2C%2CMATCH(AU2%2C%20SUBTOTAL(9%2COFFSET(B2%2C%2C%2C%2CCOLUMN(%24C%241%3A%24AS%241)-2))))%2C%22%22))%20%23NAME%3F%20is%20the%20output%2C%2C%20am%20I%20missing%20something%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2531584%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20obtain%20the%20corresponding%20headers%20of%20the%20values%20that%20are%20responsible%20for%20a%20particular%20su%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2531584%22%20slang%3D%22en-US%22%3Eyes%20I%20missed%2C%20I%20have%20excel%202013....%3CBR%20%2F%3Ecould%20you%20provide%20for%20excel%202013%3C%2FLINGO-BODY%3E
New Contributor

How do I obtain the headers (in the row 1) that are responsible for the result obtained in the cell AV3.
Say for all the values that sum up to 780 (cell AV3), sum not exceeding 1000, I want the corresponding name of the headers in the row 1 (TEXT 20, TEXT 21, TEXT 23, TEXT 26, TEXT 28, TEXT 29, TEXT 32) in one cell or may be in the adjacent cells. Test file attached
Kindly help.

5 Replies

@pratik0545 

Assuming that you have Excel 2019 or Excel in Microsoft 365:

In AX2, confirmed with Ctrl+Shift+Enter:

=TEXTJOIN(",",TRUE,IF(OFFSET(B2,,,,MATCH(AU2, SUBTOTAL(9,OFFSET(B2,,,,COLUMN($C$1:$AS$1)-2))))>0,OFFSET($B$1,,,,MATCH(AU2, SUBTOTAL(9,OFFSET(B2,,,,COLUMN($C$1:$AS$1)-2)))),""))

Fill down.

=TEXTJOIN(",",TRUE,IF(OFFSET(B2,,,,MATCH(AU2, SUBTOTAL(9,OFFSET(B2,,,,COLUMN($C$1:$AS$1)-2))))>0,OFFSET($B$1,,,,MATCH(AU2, SUBTOTAL(9,OFFSET(B2,,,,COLUMN($C$1:$AS$1)-2)))),"")) #NAME? is the output,, am I missing something?
yes I missed, I have excel 2013....
could you provide for excel 2013
best response confirmed by allyreckerman (Microsoft)
Solution

@pratik0545 

The attached version contains a custom VBA function.

The workbook is now a .xlsm workbook, so you will have to allow macros when you open it.