Forum

Notifications
Clear all

= in a formula works but <= does not!!

4 Posts
3 Users
0 Reactions
131 Views
(@andrelevesque)
Posts: 2
New Member
Topic starter
 

I have a strange issue.

The following formula works fine: =SUMIF(BudgetV9tbl[Mt '#],"="&TEXT(TODAY(),"m"),BudgetV9tbl[Budget])

It returns the sum of all the 'Budget' amounts in December (today's month expressed as a number)

But when i change the "=" for a "<=" or "<" it returns 0!!

I don't understand the problem.

Does anybody else have this problem?  What is wrong??

Thanks

 
Posted : 14/12/2023 3:08 pm
(@keebellah)
Posts: 373
Reputable Member
 

Hi, which version of Excel?

Keep in mind that the TEXT fucntion does not return a numeric value but a text with the number value

 
Posted : 15/12/2023 4:26 am
(@debaser)
Posts: 837
Member Moderator
 

Further to what Hans said, using = will cause (for reasons only MS understand) SUMIF to convert numeric text to numbers before doing the comparison, but adding in > or < will not. That suggests that the values in your [Mt '#] column are stored as text, so you might use something like:

 

=SUMPRODUCT((N(BudgetV9tbl[Mt '#])<=MONTH(TODAY()))*BudgetV9tbl[Budget])

 
Posted : 15/12/2023 6:23 am
(@andrelevesque)
Posts: 2
New Member
Topic starter
 

Thanks you Hans and Velouria.

Both your answers were useful.  The problem was with the way I generated the month number in 'Mt #'.  I used "=TEXT(A4,"M")" which generated text.  Using "=MONTH(A4)" instead solved the problem.  My original formula now works fine!

Thanks

 
Posted : 15/12/2023 8:50 am
Share: