VSTACK/HSTACK/IF

gvoisard

New Member
Joined
Aug 3, 2023
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Sheet1:
1691068977314.png

Sheet: 123:
1691069015979.png

Basically I need a formula that takes all the lines that have 123 in column "I" on sheet1 to fill on sheet "123" starting in B12. I need columns K:Q to transfer over as well as the Debit/Credit columns. However, instead of the description column from Sheet1, I would like the Condensed Description to transfer to the description column on sheet "123". I do not want the rest of the columns to transfer from Sheet1.



Let me know if you have any questions, I appreciate the help!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Make sure that the headers in sheet 123 exactly match those in sheet1 & then you can use
Excel Formula:
=FILTER(CHOOSECOLS(Sheet1!F6:Q1000,XMATCH(B10:K10,Sheet1!F5:Q5)),Sheet1!I6:I1000=B2)
 
Upvote 0
Welcome to the MrExcel board!

For the future, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

A similar option but not requiring exactly matching headers would be something like this. You may have to amend/reorder the columns of choice.

Excel Formula:
=CHOOSECOLS(FILTER(Sheet1!A6:Q8,Sheet1!I6:I8=B2),11,12,13,14,15,16,17,7,8,6)
 
Upvote 0
Welcome to the MrExcel board!

For the future, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

A similar option but not requiring exactly matching headers would be something like this. You may have to amend/reorder the columns of choice.

Excel Formula:
=CHOOSECOLS(FILTER(Sheet1!A6:Q8,Sheet1!I6:I8=B2),11,12,13,14,15,16,17,7,8,6)
Peter, I could not get that formula to work. Please see the attached spreadsheet and note that I had to add a few columns (although they can be ignored, just wanted to add because it affected the formula) and I also changed the names of the sheets. Feel free to make a copy and reshare.

Thank you.

VSTACK AND HSTACK Q.xlsx
 
Upvote 0
Which of the two "000" columns do you want to return?
 
Upvote 0
Ok, how about
VSTACK AND HSTACK Q.xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1
2
3
4
5Journal SourceJournal NameInvoice NumberSupplier NameDescriptionCondensed DescriptionDebit Credit27601276022760327604276052760627607On JV?OOBBULOCATIONDEPARTMENTNATURAL ACCOUNT000IC BU001
6Pay123ABCDEFXYZ100123111122233334444445556666777
7Pay567DEFGHIJKL100124555566677778888889990000000
8Pay456QWERTYUIO100123999988877776666665554444333
9
Checks


VSTACK AND HSTACK Q.xlsx
ABCDEFGHIJK
1
2Journal123
3
4
5
6
7
8
9
10LineBULOCATIONDEPARTMENTNATURAL ACCOUNT000IC BU001DEBITCREDITDESCRIPTION
111-45-78-1112-1920-2223-2627-29
12101111222333344444455566667771000XYZ
13209999888777766666655544443330100UIO
1430
27601 (With Formula)
Cell Formulas
RangeFormula
B12:K13B12=FILTER(CHOOSECOLS(Checks!F6:X1000,XMATCH(B10:J10,TRIM(Checks!F5:X5)),1),Checks!P6:P1000=B2)
Dynamic array formulas.
 
Upvote 1
Solution
I got this to work on the excel spreadsheet that I gave you, however, it does not work on my actual sheet. It is fairly identical except I have values (or #N/A errors in some case) in the blank cells on the checks sheet. Can you think of any reasons for this? I made sure that all the columns are the same and the sheet names are the same as the example.
 
Upvote 0
The formula won't effect what is on the Checks sheet, so not quite sure what you are saying.
 
Upvote 0
The formula won't effect what is on the Checks sheet, so not quite sure what you are saying.
I figured it out. I had #N/A in column P so I added an IFNA function and it worked. Thanks.
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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