In a recent consulting assignment I had a tricky data validation problem. The customer wanted to have an either-or condition in the data validation, like this:

My initial reaction to this requirement was “hmm… that is not possible“. But before shooting the email back to client, I got curious and checked if excel data validation can actually do this. And of course we can do this in Excel with ease.
First see the demo of how this would work:

Now to the specifics:
- Select both cells where you want this data validation to be applied.
- Now go to data validation (Data Ribbon > Data Validation or Data Menu > Validation)
- Specify validation type as “Custom” and use a formula like COUNTA() to check count of cells with a value (see the illustration)

- Optional: Use Error Message settings to set a message you prefer.
- That is all. Now your Either Or Data Validation set up is done.
Download the example file:
Click here to download the example file with this kind of data validation setup. Play with it and learn how to do this on your own.
Learn more about Data Validation in Excel:
Read more about adding a drop down list validation or advanced data validation tricks or all of them.
Related: Writing XOR (either or) formulas in Excel













5 Responses to “Preparing Profit / Loss Pivot Reports [Part 2 of 6]”
[...] Preparing Pivot Table P&L using Data sheet [...]
[...] Preparing Pivot Table P&L using Data sheet [...]
[...] Preparing Pivot Table P&L using Data sheet [...]
I am not getting sound from the videos. I have checked all the settings and spent several hours searching the Internet to no avail.
Has anyone else had this problem?
Is there anyway to get the Grand Total to be broken out in the same fashion as the items above it? For instance, if you have in column 1, widget a, widget b, and have their sales by month in column 2, I'd like to see the grand total also be by month, for widget a & b combined.
I can't get anything other than a single line for the grand total, rather than the same format as the data above.
Widget A Month Sales
Jan 100
Feb 200
Widget B
Jan 150
Feb 250
Grand total - here I would also like to have Jan, Feb.
Jan 250
Feb 450