if function problem need solving

determinedtoexceed

New Member
Joined
Aug 20, 2019
Messages
38
Dear Pros,

Please help me with 1 function that can determine whether there is any gap by item name.

example1: For itemA, "Cell E1" will show "No Gap" if b1,c1,d1 all are"No Gap"

example2: For itemA, "Cell E1" will show "Gap to 1st" when b1 ="Gap to 1st" while C1 and D1 ="No Gap"

example3: For itemA, "Cell E1" will show " Gap to 1st&Gap to 3rd" when B1=Gap to 1st, C1=No Gap, D1=Gap to 3rd

Thank you very much for your time~

ABCDEF
1itemAGap to 1stNo GapGap to 3rd:)
2itemBNo GapGap to 2ndGap to 3rd
3
4
5
6
7

<tbody>
</tbody>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Re: if funcction problem need solving

Will you only have these three columns (B, C, and D), or is this a simplified example and might you have more than 3 columns?
 
Upvote 0
Re: if funcction problem need solving

If there are only three, try this formula:
Code:
=IF(COUNTIF(B1:D1,"No Gap")=3,"No Gap",SUBSTITUTE(TRIM(IF(B1<>"No Gap",B1&" ","")&IF(C1<>"No Gap",C1&" ","")&IF(D1<>"No Gap",D1,""))," G","&G"))
 
Upvote 0
Re: if funcction problem need solving

If there are only three, try this formula:
Code:
=IF(COUNTIF(B1:D1,"No Gap")=3,"No Gap",SUBSTITUTE(TRIM(IF(B1<>"No Gap",B1&" ","")&IF(C1<>"No Gap",C1&" ","")&IF(D1<>"No Gap",D1,""))," G","&G"))
If there are only three, try this formula:
Code:
=IF(COUNTIF(B1:D1,"No Gap")=3,"No Gap",SUBSTITUTE(TRIM(IF(B1<>"No Gap",B1&" ","")&IF(C1<>"No Gap",C1&" ","")&IF(D1<>"No Gap",D1,""))," G","&G"))

Dear Joe4,

You are correct, it is indeed a simplified example, I do have more than 3 columns and when i apply the function base on methodology you provided, it did not work.

sample B1 actually locate on U10,
sample C1 actually locate on AA10
sample D1 actuly located on AG10

sample E1 result cell actually located on Q10

"NO GAP""GAP to xx" are also returned if functions


Function show blank when
Q10=IF(COUNTIF(U:AG,"NO GAP")=13,"NO GAP",SUBSTITUTE(TRIM(IF(U10<>"NO GAP",U10&" ","")&IF(AA10<>"NO GAP",AA10&" ","")&IF(AG10<>"NO GAP",AG10,""))," G","&G"))

Please help~ and thank you very much.
 
Upvote 0
Re: if funcction problem need solving

Can you Try My Formula
Code:
=INDEX({"Gap to 1st & Gap to 3rd"," Gap to 2nd  & Gap to 3rd","Gap to 1st & Gap to 2nd ","No Gap "},MATCH(B1&" "&C1&" "&D1,{"Gap to 1st No Gap Gap to 3rd","No Gap Gap to 2nd Gap to 3rd","Gap to 1st Gap to 2nd No Gap","No Gap No Gap No Gap"},0))

ABCDE
1ItemAGap to 1stNo GapGap to 3rdGap to 1st & Gap to 3rd
2ItemBNo GapGap to 2ndGap to 3rd Gap to 2nd & Gap to 3rd
3ItemCGap to 1stGap to 2ndNo GapGap to 1st & Gap to 2nd
4ItemDNo GapNo GapNo GapNo Gap

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
E1=INDEX({"Gap to 1st & Gap to 3rd"," Gap to 2nd & Gap to 3rd","Gap to 1st & Gap to 2nd ","No Gap "},MATCH(B1&" "&C1&" "&D1,{"Gap to 1st No Gap Gap to 3rd","No Gap Gap to 2nd Gap to 3rd","Gap to 1st Gap to 2nd No Gap","No Gap No Gap No Gap"},0))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Re: if funcction problem need solving

Can you Try My Formula
Code:
=INDEX({"Gap to 1st & Gap to 3rd"," Gap to 2nd  & Gap to 3rd","Gap to 1st & Gap to 2nd ","No Gap "},MATCH(B1&" "&C1&" "&D1,{"Gap to 1st No Gap Gap to 3rd","No Gap Gap to 2nd Gap to 3rd","Gap to 1st Gap to 2nd No Gap","No Gap No Gap No Gap"},0))

ABCDE
1ItemAGap to 1stNo GapGap to 3rdGap to 1st & Gap to 3rd
2ItemBNo GapGap to 2ndGap to 3rd Gap to 2nd & Gap to 3rd
3ItemCGap to 1stGap to 2ndNo GapGap to 1st & Gap to 2nd
4ItemDNo GapNo GapNo GapNo Gap

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
E1=INDEX({"Gap to 1st & Gap to 3rd"," Gap to 2nd & Gap to 3rd","Gap to 1st & Gap to 2nd ","No Gap "},MATCH(B1&" "&C1&" "&D1,{"Gap to 1st No Gap Gap to 3rd","No Gap Gap to 2nd Gap to 3rd","Gap to 1st Gap to 2nd No Gap","No Gap No Gap No Gap"},0))

<tbody>
</tbody>

<tbody>
</tbody>
Dear Salim, it will return error when C1 return Gap to 2nd

I think there are more than 10 outcomes for E1 when b,c,d are triggered
 
Upvote 0
Re: if funcction problem need solving

If this doesn't work, could we please have a few sets of more realistic sample dummy data, including where that data is located & the expected results
This is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
QRSTUVWXYZAAABACADAEAFAG
10Gap to 1st & Gap to 3rdGap to 1stNo GapGap to 3rd
11No GapNo GapNo GapNo Gap
12Gap to 1st & Gap to 2nd & Gap to 3rdGap to 1stGap to 2ndGap to 3rd
13Gap to 2ndNo GapGap to 2ndNo Gap
Gap
 
Upvote 0
Re: if funcction problem need solving

You are correct, it is indeed a simplified example, I do have more than 3 columns and when i apply the function base on methodology you provided, it did not work.
That is the danger of oversimplifying things. You get a reply that answers the exact question you asked, but doesn't really solve your problem!
For that reason, it is best NOT to oversimplify things, and give us an accurate depiction of the data you are working with.

I see that Peter has provided you with a solution, so hopefully that will work for you.
 
Last edited:
Upvote 0
Re: if funcction problem need solving

Thank you all for taking the time and helping me out to solve my problem.

All your effort is deeply appreciated.
:)
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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