take number value in column B if adjacent text value in column A equals "XXXX"

PowerpointRanger

New Member
Joined
Mar 23, 2016
Messages
1
As a small business owner I am bound to my point of sales (POS) software and sometimes its limitations. My POS will generate monthly reports that show each of my business's department sales. For example, JANUARY department sales report will be;

January:
Greeting Cards: $323
Impulse buys: $113
Boxes: $300
Mailbox Rent: $2,000
etc

However if a department has zero sales then that department is left off of the list.

February
Greeting Cards: $112
Boxes: $515
Mailbox rent: $2,500
etc

Therefore when I try and create a workbook on a separate tab that graphs and adds up all the departments I cannot simply say Department Boxes sales = cell B2 every time.

I need a macro that searches the entire first column to find a certain department "boxes" and will then populate the numeric value of sales in that department one column to the right.

looking for something that says "if [boxes] is cell A2 then show value in cell B2"
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,

I may not have understood you completely, but I think you may not need VBA/macro to accomplish what you need, if your setup is similar to my sample, and you can create a list of all your products in Sheet 2, then using VLOOKUP may do what you need:


Excel 2010
AB
1January:
2Greeting Cards:$323
3Impulse buys:$113
4Boxes:$300
5Mailbox Rent:$2,000
Sheet1


Excel 2010
AB
1DepartmentsSales
2Greeting Cards:$323
3Packing materials:$0
4Impulse buys:$113
5Stationery:$0
6Stuff:$0
7Boxes:$300
8Other stuff:$0
9Mailbox Rent:$2,000
Sheet2
Cell Formulas
RangeFormula
B2=IFERROR(VLOOKUP(A2,Sheet1!A$2:B$12,2,0),0)

Sheet 2 B2 formula copied down.

If this is not what you mean, please provide some sample data and expected results.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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