Return a list of values if another cell contains X

remobec

New Member
Joined
May 31, 2017
Messages
12
OK, I am working on an accounting sheet to keep track of grant-related expenses.

On Sheet 1, I have:
Expense | Grant

Expense is the amount. Grant is the grant it is associated with and chosen from a drop down menu.

So it might look like:
A | B
$500 | Grant 1
$20 | Grant 2
$732 | Grant 1

On Sheet 2, I am trying to list all the grant expenses for each grant.

I want it to say something like: (for Cell A2) If Sheet1, Column B equals A1, then put in the amount from Sheet 1, Column A

So it might look like:
A | B
Grant 1 | Grant 2
$500 | $20
$732 |

I have tried IF formulas and VMATCH and not really sure how to get Sheet 2 to work right.

Thank you!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Given your layout, try this:

ABC
1Grant 1Grant 2
250020
3732
4

<tbody>
</tbody>
Sheet2

Array Formulas
CellFormula
A2{=IF(A1="","",IFERROR(INDEX(Sheet1!$A:$A,SMALL(IF(Sheet1!$B$1:$B$100=A$1,ROW(Sheet1!$A$1:$A$100)),ROWS(A$2:A2))),""))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,457
Messages
6,124,941
Members
449,197
Latest member
k_bs

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