Combining IF and SUMIFS: Only getting #NAME? error

FunsizedNerd

New Member
Joined
Mar 20, 2019
Messages
17
Looking to sum a column of values based on:
- Direction of service (options are North, South, Both, based on filter value in cell)
- Journey (noted by OD) (starting location and final destination) (options are All or only one, based on filter value in cell)
- Start time of journey (options are All or only one, based on filter value in cell)
- Date (ONLY equal to certain date given in specific cell)

However, I can't find where the error is. (I'm SO sorry, it's incredibly long due to the fact that there are 12 possible options of variables to account for)

=IF($B$2=”Both Directions”,IF($B$3="ALL O-D",IF($B$4="All Times",SUMIFS(NumberOfPassengers,JourneyDate,$F4+1),SUMIFS(NumberOfPassengers,StartTime,$B$4,JourneyDate,$F4+1)),IF($B$4="All Times",SUMIFS(NumberOfPassengers,OD,$B$3,JourneyDate,$F4+1),SUMIFS(NumberOfPassengers,StartTime,$B$4,OD,$B$3,JourneyDate,$F4+1))),IF($B$2=”Southbound”,IF($B$3="All Southbound",IF($B$4="All Southbound",SUMIFS(NumberOfPassengers,JourneyDate,$F4+1),SUMIFS(NumberOfPassengers,StartTime,$B$4,JourneyDate,$F4+1)),IF($B$4="All Southbound",SUMIFS(NumberOfPassengers,OD,$B$3,JourneyDate,$F4+1),SUMIFS(NumberOfPassengers,StartTime,$B$4,OD,$B$3,JourneyDate,$F4+1))),IF($B$2=”Northbound”,IF($B$3="All Northbound",IF($B$4="All Northbound",SUMIFS(NumberOfPassengers,JourneyDate,$F4+1),SUMIFS(NumberOfPassengers,StartTime,$B$4,JourneyDate,$F4+1)),IF($B$4="All Northbound",SUMIFS(NumberOfPassengers,OD,$B$3,JourneyDate,$F4+1),SUMIFS(NumberOfPassengers,StartTime,$B$4,OD,$B$3,JourneyDate,$F4+1))))))

DirectionBoth Directions/Northbound/Southbound
JourneyAll Journeys/One Journey
Start TimeAll Times/One Time

<tbody>
</tbody>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
There must be some dodgy character in your formula.
I've just shortened the formula to this

=IF($B$2=”Both Directions”,IF($B$3="ALL O-D",IF($B$4="All Times","XXX"),"YYY"),"ZZZ")

and I too get #NAME ? error
But when I type this from scratch

=IF($B$2="Both Directions",IF($B$3="ALL O-D",IF($B$4="All Times","XXX"),"YYY"),"ZZZ")

it returns ZZZ (I have a blank sheet).
Point is it does't return an #NAME ? error

NOTE: I'm sure there's a better way to write that formula, maybe using tables possibly.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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