How to create text in a cell based on the values of multiple cells

grfbro1

New Member
Joined
Jul 31, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello - I'm trying to create a sentence in a cell based on the values in other cells in a different worksheet. On one worksheet is the picture below where the entries are made and i can put in yes or no.

1690839610514.png


Based on the entries to theses cells, I want to create a sentence below on a separate worksheet:

NOTES: Vacation, Sick, Medical, Reporting, and Mercury will be billed as incurred.

If the user has a no in the cell, than that word will not be in the sentence. The user can only select yes or no and all the yes answers will show the cell above in the sentence with a , separating the words.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Excel Formula:
=IF(CONCAT(IF(B2="Yes",B1&", ",""),IF(C2="Yes",C1&", ",""),IF(D2="Yes",D1&", ",""),IF(E2="Yes",E1&", ",""),IF(F2="Yes",F1&", ",""),IF(G2="Yes",G1&", ",""))="","Nothing",LEFT(CONCAT(IF(B2="Yes",B1&", ",""),IF(C2="Yes",C1&", ",""),IF(D2="Yes",D1&", ",""),IF(E2="Yes",E1&", ",""),IF(F2="Yes",F1&", ",""),IF(G2="Yes",G1&", ","")),LEN(CONCAT(IF(B2="Yes",B1&", ",""),IF(C2="Yes",C1&", ",""),IF(D2="Yes",D1&", ",""),IF(E2="Yes",E1&", ",""),IF(F2="Yes",F1&", ",""),IF(G2="Yes",G1&", ","")))-2)&" will be billed as incurred")

this is the formula to concatenate the verbiage but more data is needed on the criteria of showing the data on other worksheets
 
Upvote 0
Solution
Glad to hear.
You might wanna mark as a solution for future researchers.

Thanks!
 
Upvote 0
Welcome to the MrExcel board!

That worked perfect.
It doesn't seem to quite give the same result as your example in post 1. However, if that is the result you want, then you could also try this much shorter & more easily extendable version.

23 08 01.xlsm
BCDEFGH
1abcdef
2YesYesYesYesYesNoa, b, c, d, e will be billed as incurred
3NoNoNoNoNoNoNothing
4NoYesNoYesNoYesb, d, f will be billed as incurred
5Nothing
6NoNoYesNoNoNoc will be billed as incurred
grfbro1
Cell Formulas
RangeFormula
H2:H6H2=LET(t,TEXTJOIN(", ",1,FILTER(B$1:G$1,B2:G2="Yes","")),t&IF(LEN(t)," will be billed as incurred","Nothing"))
 
Upvote 0
I want to create a sentence below on a separate worksheet:
I forgot about that when providing my previous response. The adjustment would be something like this.

grfbro1.xlsm
ABCDEFG
1abcdef
2YesYesYesYesYesNo
3NoNoNoNoNoNo
4NoYesNoYesNoYes
5
6NoNoYesNoNoNo
Sheet1


Cell Formulas
RangeFormula
A2:A6A2=LET(t,TEXTJOIN(", ",1,FILTER(Sheet1!B$1:G$1,Sheet1!B2:G2="Yes","")),t&IF(LEN(t)," will be billed as incurred","Nothing"))
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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