excelexcel-formula# Excel IF AND statement with multiple results

I would like to develop the formula based on the IF(AND) statement, which will throw more than 2 results. Usually, it's just 2 (value if true and value if false). I am just wondering if it could be possible to have something like the "nested" output values i.e. Value 1 if True, Value 2 If true within the false, and Value 3 if false within the false.

I have the calendar work and I would like to put the "%" for Saturday's column and "Cost" for Sunday's one.

but with the following formula:

```
=IF(AND(WEEKDAY(AG9,2))=7,"Cost",IF(WEEKDAY(AG9,2)=6,"%",AG9))
```

am just able to reproduce the second one.

Is there any way to have 3 output values or should I develop the same one in the separate row?

Solution

This works for me, OP needs to remove the `AND()`

function. using `SWITCH()`

looks more cleaner and neater here:

```
=SWITCH(WEEKDAY(A1,2),6,"%",7,"Cost",A1)
```

Or,

```
=IF(WEEKDAY(A1,2)=7,"Cost",IF(WEEKDAY(A1,2)=6,"%",A1))
```

Or,

```
=SWITCH(WEEKDAY(A1:L1,2),6,"%",7,"Cost",A1:L1)
```

**Note:** Change cell references and ranges accordingly as per your suit.

- Build vertical summary from Columns with Count
- Excel - Create a Unit Conversion sheet - Multiple links
- update cell when column header matches a list
- Delete text in cell subject to Worksheet_Change
- Counting the number of visible rows after autofilter
- Excel 2007: AVERAGEIF, SUMIF, COUNTIF, MAXIF, MINIF across multiple sheets, multple rows
- Import CSV data from a txt file skipping the first line and adding headers
- Simplifying SumIFs formulas for efficient excel formula
- I'd like to find out how to find the current streak of non-negative numbers in a row of data in Excel
- ValueError: Invalid character found in sheet title
- decrypt excel files
- Excel table search funcion that looks for partial string match
- Combine macros to filter on today's and tomorrow's date
- Converting line breaks to commas in excel sheet using Powershell
- Combinations of numbers arranged side by side as many as a random number (VBA)
- How can I remove ONLY leading and trailing spaces while leaving spaces in between words alone with an excel formula?
- VBA Date as integer
- Sliding Window Auto Increment Range
- Count cells with different conditional ranges
- Turning flattened pivots data into tables -Error tables can't overlap - Excel Vba
- How do I get only a specific part of a cell in Excel or Numbers?
- Calculate the Legendre symbol of two integers in Excel
- Unable to get text wrapping or vertical centering to work with xlsxwriter
- Number stored as text warning in excel using POI
- VBA Excel paste to the columns in regular intervals
- Convert filtered values from formulas to values
- Sorting Dictionary by nested class objects data [VBA]
- Events does not appear when making an Outlook query from Excel
- The script works well when I use MSXML2.XMLHTTP.6.0, but it fails miserably when I switch to MSXML2.serverXMLHTTP.6.0
- How to convert text string (d h m s) to time format in excel