Solved

Excel / Powershell  If statement with 3 variables

Posted on 2014-09-11
2
189 Views
Last Modified: 2014-09-11
Dear experts,

could anybody help me with this formula below?

If GAL =  -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&

if GUL = -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"

all other not GUL or GAL = -CustomAttribute4 '"&P2&"  -CustomAttribute10 'LT' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"  (same as "GUL")

I tried this behind but failed ;)  Thanks in advance!


="Start-Sleep -s 10;Set-Mailbox "&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),&" -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&"' -Identity "&A2&"",A2&" -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"'-Identity "&A2&"))"

="Start-Sleep -s 10;Set-Mailbox "&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),&" -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&"' -Identity "&A2&"",A2&" -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"'-Identity "&A2&"))"

Open in new window

0
Comment
Question by:Mandy_
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40316712
pls try

="Start-Sleep -s 10;Set-Mailbox  -CustomAttribute4 '"&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),P2&"' -CustomAttribute10 'LT' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2,"T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2),"T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2&"';'smtp:"&G2)&"' -Identity "&A2
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40316886
perfect as usual. Great work!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Synchronize a new Active Directory domain with an existing Office 365 tenant
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now