IF Formula

eramirez148

Board Regular
Joined
Aug 17, 2022
Messages
54
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
Platform
  1. Windows
  2. MacOS
Is there a possible formula that will give me the following results in column A.
If the values from column B to column I are all zeros then the result should be zero. But if the values are higher than zero I want it to populate all the values except the zeros.


Column AColumn BColumn CColumn DColumn EColumn FColumn GColumn HColumn I
20, 19, 5, 8, 10
20​
19​
0​
0​
5​
8​
10​
0​
0​
0​
0​
0​
0​
0​
0​
0​
0​
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
For D365 version, try
Book1
ABCDEFGHIJ
120, 19, 5, 8, 1020190058100
2000000000
3
4
Sheet4
Cell Formulas
RangeFormula
A1A1=LET(f,FILTER(B1:I1,B1:I1<>0),IFERROR(TEXTJOIN(", ",TRUE,f),0))
A2A2=LET(f,FILTER(B2:I2,B2:I2<>0),IFERROR(TEXTJOIN(",",TRUE,f),0))
 
Upvote 0
For D365 version, try
Book1
ABCDEFGHIJ
120, 19, 5, 8, 1020190058100
2000000000
3
4
Sheet4
Cell Formulas
RangeFormula
A1A1=LET(f,FILTER(B1:I1,B1:I1<>0),IFERROR(TEXTJOIN(", ",TRUE,f),0))
A2A2=LET(f,FILTER(B2:I2,B2:I2<>0),IFERROR(TEXTJOIN(",",TRUE,f),0))


I have an additional issue,

I have additional columns in between the columns I want to consider in the formula how can I update the formula so that ignores the columns I do not want to include. For example I want to exclude columns B,B, F, H, J, L, N, P.

Column AColumn BColumn CColumn DColumn EColumn FColumn GColumn HColumn IColumn JColumn KColumn LColumn MColumn NColumn OColumn PColumn Q
20, 19, 5, 8, 10
5359.2​
20​
5369.2​
19​
5449.2​
0​
10449.2​
0​
4760.2​
5​
-10​
8​
89​
10​
10​
0​
0​
8​
0​
18​
0​
98​
0​
5098​
0​
-591​
0​
-10​
0​
89​
0​
10​
0​
 
Upvote 0
How about this?
Book1
ABCDEFGHIJKLMNOPQR
120, 19, 5, 8, 10535920535919535901044904760.25-1088910100
208018098050980-5910-100890100
3
Sheet7
Cell Formulas
RangeFormula
A1:A2A1=LET(data,B1:Q1, f,FILTER(data,(MOD(COLUMN(data),2)*(data<>0))),IFERROR(TEXTJOIN(", ",TRUE, f),0))
 
Upvote 0
This works. In if I happen to have an additional column in between can you provide a formula for that so I can keep it in my records
 
Upvote 0
FWIW, with the initial layout there is no need for the IFERROR, and also no advantage in using LET in that circumstance.

24 04 07.xlsm
ABCDEFGHI
120, 19, 5, 8, 1020190058100
2000000000
TJ
Cell Formulas
RangeFormula
A1:A2A1=TEXTJOIN(", ",,FILTER(B1:I1,B1:I1<>0,0))


In relation to your follow-up questions: Do any of the columns have headings? If so, could we see the sample data including the headings?
 
Upvote 0
FWIW, with the initial layout there is no need for the IFERROR, and also no advantage in using LET in that circumstance.

24 04 07.xlsm
ABCDEFGHI
120, 19, 5, 8, 1020190058100
2000000000
TJ
Cell Formulas
RangeFormula
A1:A2A1=TEXTJOIN(", ",,FILTER(B1:I1,B1:I1<>0,0))


In relation to your follow-up questions: Do any of the columns have headings? If so, could we see the sample data including the headings?

This is how the data will look including headings. Pretty much in column Root causes flagged. I want to populate the number on each root cause. The problem is that they will continue to add columns in between so if there is a way to specifically select only the root cause columns that would be great.

In the example below The root cause flagged column flagged 18,10,11,12 and if all were to be 0 then the results will be 0


Root causes FlaggedNumber of instances product was out of stockRoot CauseInitial StockBalanceRoot CauseDelivered Quantity against STOBalanceRoot CauseSTO QuantityBalanceRoot CauseStore Order ForecastBalanceRoot CauseAdjustments to available stockBalanceRoot Cause
18,10,11,120187,20947%1032,66223%1132,66223%032,66223%12-68721%0
 
Upvote 0
With Peter's comment and the header, it would've been easier if you showed the complete inquiry from the start. Peter might have other inputs.
Book1
ABCDEFGHIJKLMNOPQRS
1Root causes FlaggedNumber of instances product was out of stockRoot CauseInitial StockBalanceRoot CauseDelivered Quantity against STOBalanceRoot CauseSTO QuantityBalanceRoot CauseStore Order ForecastBalanceRoot CauseAdjustments to available stockBalanceRoot Cause
218, 10, 11, 1201872090.4710326620.2311326620.230326620.2312-6870.210
3000000000000000000
4
5
Sheet9
Cell Formulas
RangeFormula
A2:A3A2=TEXTJOIN(", ",,FILTER(B2:R2,($B$1:$R$1="Root Cause")*(B2:R2<>0),0))
 
Last edited:
Upvote 1
Solution
With Peter's comment and the header, it would've been easier if you showed the complete inquiry from the start. Peter might have other inputs.
Book1
ABCDEFGHIJKLMNOPQRS
1Root causes FlaggedNumber of instances product was out of stockRoot CauseInitial StockBalanceRoot CauseDelivered Quantity against STOBalanceRoot CauseSTO QuantityBalanceRoot CauseStore Order ForecastBalanceRoot CauseAdjustments to available stockBalanceRoot Cause
218, 10, 11, 1201872090.4710326620.2311326620.230326620.2312-6870.210
3000000000000000000
4
Sheet9
Cell Formulas
RangeFormula
A2:A3A2=TEXTJOIN(", ",,FILTER(B2:R2,(B1:R1="Root Cause")*(B2:R2<>0),0))
Sorry about that but this work perfect.

One thing I notice is that the result is not in numerical value is this the case? or can the results be formatted as numerical value
.
 
Upvote 0
Not the way you want to show it i.e. numbers separated by comma.
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,698
Members
449,117
Latest member
Aaagu

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