2 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

HSTACK where second column is based on values from first column

Our take

Are you struggling to create a two-column array with HSTACK in your spreadsheet? You’re not alone. Many users encounter challenges when trying to dynamically sum values based on corresponding entries from another tab. In your case, it seems the formula is only working for the first row, leaving you with incomplete data. By leveraging the LET function, you can streamline your approach. Keep reading for a clearer breakdown of how to adjust your formula for seamless integration, ensuring all rows reflect the correct sums dynamically.

Hi all,

I am trying to use HSTACK to make a two column array. The column A is very straight forward, just copying a column from another tab. The second column however, is giving me problems. I want it to check other tabs and sum the amount of times the corresponding row in column A appears. I can only seem to do this for the first row before it throws a fit.

What I have right now that's not working:

=HSTACK( 'Sheet1'!$B$2:$B$27, SUM(COUNTIF('Other Sheets'!$B$54:$B$73,'Sheet1'!$B$2:$B$27)) ) 

If I change it to:

=HSTACK( 'Sheet1'!$B$2:$B$27, SUM(COUNTIF('Other Sheets'!$B$54:$B$73,'Sheet1'!$B$2)) ) 

It prints all of Column A correctly, but only Row 1 of Column B as expected, but that tells me the general idea works.

Thanks in advance for any advice!

EDIT: I had summarized some of the other stuff in the formula to not have to explain it all, realized after some misunderstanding that's not a great idea, here's the actual function that's not working:

=LET( x,'Background Data'!$B$2:$B$27, HSTACK(x, SUM(COUNTIF(INDIRECT("'"&IncludedGames&"'!$B$54:$B$73"),x)) ) ) 

I have a Name set up for "IncludedGames" to list all sheets to be checked based on a checkbox list. This works perfectly for everything else on the sheet, including referencing it with INDIRECT that way, so that's not the issue, and if I replace the last "x" in the formula with "'Background Data'!$B$2" it will print the correct value, just can't list it.

submitted by /u/Icy-Feeling8091
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Related Articles