diff --git a/ChangeLog b/ChangeLog
index 6a51db0..2652383 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-03  Morten Welinder  <terra@gnome.org>
+
+	* src/parse-util.c (parse_text_value_or_expr): Drop cur_fmt and
+	date_conv arguments and deduce these from parse position.  All
+	callers changed.  Drop value formats that are the same as the cell
+	formats.  Fixes confusion in #651667.
+
 2011-05-30  Morten Welinder  <terra@gnome.org>
 
 	* src/gui-clipboard.c (gnm_x_claim_clipboard): Rename from
diff --git a/src/cell.c b/src/cell.c
index e6bd1a6..ca0ce1a 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -97,8 +97,7 @@ gnm_cell_set_text (GnmCell *cell, char const *text)
 	g_return_if_fail (!gnm_cell_is_nonsingleton_array (cell));
 
 	parse_text_value_or_expr (parse_pos_init_cell (&pos, cell),
-		text, &val, &texpr, gnm_style_get_format (gnm_cell_get_style (cell)),
-		workbook_date_conv (cell->base.sheet->workbook));
+		text, &val, &texpr);
 
 	if (val != NULL) {	/* String was a value */
 		gnm_cell_cleanout (cell);
diff --git a/src/commands.c b/src/commands.c
index deb28e1..362b7fa 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -4178,9 +4178,7 @@ cmd_search_replace_do_cell (CmdSearchReplace *me, GnmEvalPos *ep,
 		GnmParsePos pp;
 
 		parse_pos_init_evalpos (&pp, ep);
-		parse_text_value_or_expr (&pp, cell_res.new_text, &val, &texpr,
-			gnm_style_get_format (gnm_cell_get_style (cell_res.cell)),
-			workbook_date_conv (cell_res.cell->base.sheet->workbook));
+		parse_text_value_or_expr (&pp, cell_res.new_text, &val, &texpr);
 
 		/*
 		 * FIXME: this is a hack, but parse_text_value_or_expr
diff --git a/src/parse-util.c b/src/parse-util.c
index ac00a83..af54686 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -36,6 +36,8 @@
 #include "gnm-format.h"
 #include "expr-name.h"
 #include "func.h"
+#include "mstyle.h"
+#include "sheet-style.h"
 /* For std_expr_name_handler: */
 #include "expr-impl.h"
 #include "gutils.h"
@@ -723,26 +725,51 @@ gnm_expr_char_start_p (char const * c)
  * @text: The text to be parsed.
  * @val : Returns a GnmValue* if the text was a value, otherwise NULL.
  * @texpr: Returns a GnmExprTop* if the text was an expression, otherwise NULL.
- * @cur_fmt : Optional, current number format.
- * @date_conv : Optional, date parse conventions
  *
  * If there is a parse failure for an expression an error GnmValue with the syntax
  * error is returned.
  */
 void
 parse_text_value_or_expr (GnmParsePos const *pos, char const *text,
-			  GnmValue **val, GnmExprTop const **texpr,
-			  GOFormat const *cur_fmt,
-			  GODateConventions const *date_conv)
+			  GnmValue **val, GnmExprTop const **texpr)
 {
 	char const *expr_start;
+	GODateConventions const *date_conv;
+	GOFormat const *cur_fmt;
+	GOFormat const *cell_fmt;
+	GnmStyle const *cell_style;
 
 	*texpr = NULL;
+	*val = NULL;
+
+	/* Determine context information.  */
+	date_conv =
+		pos->sheet
+		? workbook_date_conv (pos->sheet->workbook)
+		: (pos->wb
+		   ? workbook_date_conv (pos->wb)
+		   : NULL);
+	cell_style = pos->sheet
+		? sheet_style_get (pos->sheet, pos->eval.col, pos->eval.row)
+		: NULL;
+	cur_fmt = cell_fmt = cell_style ? gnm_style_get_format (cell_style) : NULL;
+	if (cell_fmt && go_format_is_general (cell_fmt)) {
+		GnmCell const *cell = pos->sheet
+			? sheet_cell_get (pos->sheet, pos->eval.col, pos->eval.row)
+			: NULL;
+		if (cell && cell->value && VALUE_FMT (cell->value))
+			cur_fmt = VALUE_FMT (cell->value);
+	}
 
 	/* Does it match any formats?  */
 	*val = format_match (text, cur_fmt, date_conv);
-	if (*val != NULL)
+	if (*val != NULL) {
+		GOFormat const *val_fmt = VALUE_FMT (*val);
+		/* Avoid value formats we don't need.  */
+		if (val_fmt && go_format_eq (cell_fmt, val_fmt))
+			value_set_fmt (*val, NULL);
 		return;
+	}
 
 	/* If it does not match known formats, see if it is an expression */
 	expr_start = gnm_expr_char_start_p (text);
diff --git a/src/parse-util.h b/src/parse-util.h
index 1b0b39c..318f196 100644
--- a/src/parse-util.h
+++ b/src/parse-util.h
@@ -229,9 +229,7 @@ char const *gnm_expr_char_start_p (char const *c);
 void	    parse_text_value_or_expr (GnmParsePos const *pos,
 				      char const *text,
 				      GnmValue **val,
-				      GnmExprTop const **texpr,
-				      GOFormat const *current_format,
-				      GODateConventions const *date_conv);
+				      GnmExprTop const **texpr);
 
 GString	*gnm_expr_conv_quote (GnmConventions const *conv, char const *str);
 
diff --git a/src/sheet.c b/src/sheet.c
index c44e21f..32ec828 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -2598,9 +2598,7 @@ sheet_range_set_text (GnmParsePos const *pos, GnmRange const *r, char const *str
 {
 	closure_set_cell_value	closure;
 	GSList *merged, *ptr;
-	GOFormat const *fmt;
 	Sheet *sheet;
-	GnmCell *cell;
 
 	g_return_if_fail (pos != NULL);
 	g_return_if_fail (r != NULL);
@@ -2608,14 +2606,8 @@ sheet_range_set_text (GnmParsePos const *pos, GnmRange const *r, char const *str
 
 	sheet = pos->sheet;
 
-	/* Arbitrarily Use the format from upper left cell.  */
-	cell = sheet_cell_get (sheet, r->start.col, r->start.row);
-	fmt = cell ? gnm_cell_get_format (cell) : NULL;
-
 	parse_text_value_or_expr (pos, str,
-				  &closure.val, &closure.texpr,
-				  fmt,
-				  workbook_date_conv (sheet->workbook));
+				  &closure.val, &closure.texpr);
 
 	if (closure.texpr) {
 		range_init_full_sheet (&closure.expr_bound, sheet);
@@ -2763,9 +2755,7 @@ sheet_cell_set_text (GnmCell *cell, char const *text, PangoAttrList *markup)
 	g_return_if_fail (!gnm_cell_is_nonsingleton_array (cell));
 
 	parse_text_value_or_expr (parse_pos_init_cell (&pp, cell),
-		text, &val, &texpr,
-		gnm_cell_get_format (cell),
-		workbook_date_conv (cell->base.sheet->workbook));
+		text, &val, &texpr);
 
 	/* Queue a redraw before in case the span changes */
 	sheet_redraw_cell (cell);
