if cell has any value, then return text in different cell

liloo

New Member
Joined
May 2, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I created a simple table to illustrate the data I have in my original workbook. In my workbook, this table is pulled from another sheet using VLOOKUP. The values are quantity purchased by each company. "-" indicates the company did not purchase anything in said year for said product. "0" indicates the company did purchase said product, in a particular quarter of the year.

I would like to show in a new column the tally for each company. I want to write a formula that would spit out "2019Q4_A, 2019Q2_B, 2020Q2_B, 2020Q4_C" for ABC Inc. I don't know where to start. I've been looking up different functions and imagine this may be a combination of VLOOKUP, ISNUMBER and COUNTIF???

Any guidance is much appreciated!


Book1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXY
12019Q1 Product A2019Q2 Product A2019Q3 Product A2019Q4 Product A2019Q1 Product B2019Q2 Product B2019Q3 Product B2019Q4 Product B2019Q1 Product C2019Q2 Product C2019Q3 Product C2019Q4 Product C2020Q1 Product A2020Q2 Product A2020Q3 Product A2020Q4 Product A2020Q1 Product B2020Q2 Product B2020Q3 Product B2020Q4 Product B2020Q1 Product C2020Q2 Product C2020Q3 Product C2020Q4 Product C
2ABC Inc00040600--------0100000020
3DEF Corp----1002----10000050----
4GHI Ltd10000------------0100000500
5JKL Enterprise01010202----01006000----
6MNO Ltd------------00200008----
Sheet1
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome.

What result are you looking for? The sum of those three, how many have values (0), how many have "-" ??
 
Upvote 0
If you want the sum of those you specified, try this:

Code:
=SUM(INDEX($A2:$Y2,1,{5,7,19,25}))
 
Upvote 0
Welcome.

What result are you looking for? The sum of those three, how many have values (0), how many have "-" ??
Hi kweaver,
I’m not looking for the sum. I want it to summarize each company’s purchase activity in text form.
My workbook has over 3000 rows and growing. I can’t think of a better way to do this.
 
Upvote 0
So, do you want the resulting cell to be a join of those period indicators that have numbers > 0?
 
Upvote 0
Is this what you're looking for (fill down):

Code:
=TEXTJOIN(", ",TRUE,FILTER($B$1:$Y$1,(B2:Y2>0)*(B2:Y2<>"-")))
 
Upvote 0
So, do you want the resulting cell to be a join of those period indicators that have numbers > 0?
Yes, e.g. for ABC Inc (Row 2), I want to add a new cell/column at the end that says “2019Q4_A, 2019Q2_B, 2020Q2_B, 2020Q4_C". I need a formula that identifies those cells with a value other than 0 and -, and summarize them.
Thank you for helping! I’ve been thinking about it for over a week now and decided I should ask for help.
 
Upvote 0
Is this what you're looking for (fill down):

Code:
=TEXTJOIN(", ",TRUE,FILTER($B$1:$Y$1,(B2:Y2>0)*(B2:Y2<>"-")))
Yes, this totally worked on my sample table, but it gave me "1" on my actual workbook. Is it because the cells B2:Y2 in my actual workbook are populated by formula?
 
Upvote 0
Having a formula in a cell shouldn't matter. What was the data in the row where you got a 1 as the result?
 
Upvote 0
Yes, this totally worked on my sample table, but it gave me "1" on my actual workbook. Is it because the cells B2:Y2 in my actual workbook are populated by formula

Having a formula in a cell shouldn't matter. What was the data in the row where you got a 1 as the result?
Actually, it works! My eyes were deceiving me of the cell numbers. It gave me the results as expected. Thank you so much!!!
 
Upvote 0

Forum statistics

Threads
1,215,262
Messages
6,123,953
Members
449,135
Latest member
jcschafer209

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