Don't show a formula if cell is empty

Edwin_SVRZ

New Member
Joined
May 7, 2024
Messages
2
Office Version
  1. 365
I have the following formula: (the formula is in Dutch)

Excel Formula:
=ALS(D2="";"('"&A2&"', '"&TEKST(C2;"jjjj-mm-dd")&"', '"&E2&"'),";"('"&A2&"', '"&TEKST(C2;"jjjj-mm-dd")&"', '"&D2&"'),")

What this does it it checks if cell D2 is empty. If so it uses the value of cell E2 and if it's not empty it uses the value of cell D2 in the formula.
This works, but if I copy the formula to +500 rows and I only have 400 rows, it shows a part of the formula, since there is nog value in D2 or E2.
If the cells D2 ande E2 are empty I dont want it to give a result.

What do I need to change in the formula to get this to work?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
If the cells D2 ande E2 are empty I dont want it to give a result.
Hi, you could like this:

Excel Formula:
=ALS(EN(D2="";E2="");"";ALS(D2="";"('"&A2&"', '"&TEKST(C2;"jjjj-mm-dd")&"', '"&E2&"'),";"('"&A2&"', '"&TEKST(C2;"jjjj-mm-dd")&"', '"&D2&"'),"))
 
Upvote 0
And I think you can probably shorten the whole thing a bit like this:

Excel Formula:
=ALS(EN(D2="";E2="");"";"('"&A2&"', '"&TEKST(C2;"jjjj-mm-dd")&"', '"&ALS(D2="";E2;D2)&"'),")
 
Upvote 0
Solution
And I think you can probably shorten the whole thing a bit like this:

Excel Formula:
=ALS(EN(D2="";E2="");"";"('"&A2&"', '"&TEKST(C2;"jjjj-mm-dd")&"', '"&ALS(D2="";E2;D2)&"'),")
That's a lot shorter and it works perfectly.
Thanks !!
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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